Skip to content

JIT: fix user-method arg forwarding — AOT late static binding (#1231) - #3864

Merged
PurHur merged 5 commits into
masterfrom
agent/issue-1238-wave2-tracker-close
May 31, 2026
Merged

PurHur merged 5 commits into
masterfrom
agent/issue-1238-wave2-tracker-close

Conversation

@PurHur

@PurHur PurHur commented May 30, 2026

Copy link
Copy Markdown
Owner

Summary

  • Fixes a regression where compileBlockInternal() gained $startIndex / $allowRecompile parameters but call sites (especially runQueue) still spread LLVM $argVars into positional slot 5 ($startIndex) instead of the variadic ...$args.
  • User instance methods with $this (e.g. Box::doubled() calling static::size()) failed AOT compile with TypeError: Argument #5 ($startIndex) must be of type int, Variable given.
  • Updates all internal spread call sites to pass explicit 0, false before ...$args.
  • Adds unit tests guarding both user-method and extends-chain static:: JIT compile smoke.

Advances wave-2 tracker #1238 (LSB row was marked AOT=yes but fixture failed).

php-src reference

  • Zend/zend_compile.c — late static binding / called-class propagation
  • Zend/zend_execute.cZEND_FETCH_CLASS / static call dispatch

Verification

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter late_static_binding'
# OK (3 tests, 7 assertions) — VM compliance + AOT fixture

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit test/unit/JIT/CompileBlockInternalArgForwardingTest.php'
# OK (2 tests) — JIT compile smoke for user methods + extends chain

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter "anonymous_class|clone_object|late_static_binding" test/aot/AotTest.php'
# OK (3 tests, 15 assertions)

Closes #1231
Closes #1238

Made with Cursor

@PurHur

PurHur commented May 30, 2026

Copy link
Copy Markdown
Owner Author

Verification (cursor-agent-lane-c, May 2026)

Rebased onto current master (already up to date). Targeted tests green in Docker:

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter late_static_binding'
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter "anonymous_class|clone_object|late_static_binding" test/aot/AotTest.php'

Advances wave-2 tracker #1238 (AOT late_static_binding.phpt was failing on master due to $startIndex slot confusion in runQueue).

PurHur and others added 5 commits May 31, 2026 09:01
Add JIT compile smoke so LLVM param Variables are not bound to $startIndex
when lowering instance methods that call static:: (late_static_binding AOT).

Co-authored-by: Cursor <cursoragent@cursor.com>
Guard compileBlockInternal arg forwarding when instance methods call
static:: in an extends chain (Child extends Base, static::who()).

Co-authored-by: Cursor <cursoragent@cursor.com>
Guards compileBlockInternal arg forwarding for parent:: static calls
inside user instance methods (Zend parent:: dispatch / #1858).

Co-authored-by: Cursor <cursoragent@cursor.com>
Wire wave-2 LSB fixture into AotRegressionFixtureCatalogTest so AOT
compile-only CI catches compileBlockInternal arg forwarding regressions
without full LLVM link.

php-src: Zend/zend_compile.c — late static binding / static call dispatch
Co-authored-by: Cursor <cursoragent@cursor.com>
Add MCJIT subprocess test asserting static:: in user methods runs after
the runQueue() arg-forwarding fix; compile-only tests remain LLVM-free.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur force-pushed the agent/issue-1238-wave2-tracker-close branch from bbd2316 to 6fabd3e Compare May 31, 2026 09:01
@PurHur
PurHur merged commit 5760172 into master May 31, 2026
@PurHur
PurHur deleted the agent/issue-1238-wave2-tracker-close branch May 31, 2026 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Language features wave 2: JIT/syntax gaps tracker (#1222–#1235) Language: late static binding (static::method())

1 participant