Repository navigation
Language: user class const fetch from global functions (#2215) - #2226
Merged
Merged
Conversation
Owner
Author
|
Runforge harness verification
Not merged here: `./script/docker-ci-local.sh fast` stops on pre-existing `docs/capabilities.md` drift on `master` (before PHPUnit). JIT CLI also fails in this image during LLVM bitcode preload (`MemoryBuffer::parseBitcode`), unrelated to this diff. Recommend merge after `make test-harness` (or full `ci-local.sh`) on a host with working LLVM 9. |
PurHur
force-pushed
the
issue-2215-class-const-fetch-user
branch
from
May 26, 2026 00:49
730537d to
70b293c
Compare
JIT compiles function bodies at TYPE_FUNCDEF before member constants exist when a global function references ClassName::CONST above the class in source (MiniWebApp Router). Emit DECLARE_CLASS/enum/interface before FUNCDEF and add a compliance case for the Router-style pattern. Co-authored-by: Cursor <cursoragent@cursor.com>
JIT/AOT compile member constants before function bodies that reference ClassName::CONST (MiniWebApp Router::DEFAULT_CONTACT_NAME_MAX). Add VM/AOT compliance tests and register ClassConstFetchVMTest for ci-fast --filter. Closes #2215 Co-authored-by: Cursor <cursoragent@cursor.com>
PurHur
force-pushed
the
issue-2215-class-const-fetch-user
branch
from
May 26, 2026 00:49
70b293c to
d213e25
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
DECLARE_CLASS/ enum / interface opcodes beforeFUNCDEFinCompiler::compileOpsso JIT/AOT compile member constants before function bodies that referenceClassName::CONST(MiniWebAppRouter::DEFAULT_CONTACT_NAME_MAXpattern).test/compliance/cases/classes/class_const_fetch_user.phpt, AOT fixture, andClassConstFetchVMTestforci-fast --filter ClassConstFetch.Problem
examples/003-MiniWebApp/src/Router.phpdeclares a global helper aboveclass Routerwithpublic const. VM worked (constants exist at call time), but JIT compilesFUNCDEFbodies eagerly and previously hitUndefined class constantwhenTYPE_DECLARE_CLASSran later in the opcode stream.Test plan
php bin/vm.phpRouter-style snippet →200./phpc lint examples/003-MiniWebApp/src/Router.php(zero unsupported)vendor/bin/phpunit --filter ClassConstFetch(VM + AOT; 4 tests)Closes #2215