Skip to content

php-in-php: route bound-method FCC through VmBoundMethodCallable (#10185) - #11621

Merged
PurHur merged 1 commit into
masterfrom
agent/issue-10185-bound-method-php
Jun 25, 2026
Merged

php-in-php: route bound-method FCC through VmBoundMethodCallable (#10185)#11621
PurHur merged 1 commit into
masterfrom
agent/issue-10185-bound-method-php

Conversation

@PurHur

@PurHur PurHur commented Jun 25, 2026

Copy link
Copy Markdown
Owner

Summary

  • Move [object, method] first-class callable resolution from lib/JIT/BoundMethodCallableHelper.php (~381 lines) into VM SSOT lib/VM/VmBoundMethodCallable.php
  • JIT helper shrinks to thin trampoline (~56 lines)
  • VmFromCallable calls VmBoundMethodCallable directly (no JIT-layer indirection)

Closes #10185

php-src reference

  • Zend/zend_compile.czend_compile_callable
  • Zend/zend_execute.cZEND_INIT_FCALL bound method path

Shrink

File Before After
lib/JIT/BoundMethodCallableHelper.php 381 lines 56 lines trampoline
lib/VM/VmBoundMethodCallable.php 387 lines PHP SSOT

Test plan

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
vendor/bin/phpunit test/unit/BoundMethodCallableHelperRuntimeShrinkTest.php
vendor/bin/phpunit test/unit/FromCallableRuntimeShrinkTest.php
php bin/jit.php -r "
class C { public function m(): int { return 1; } }
\$f = [new C, \"m\"];
echo \$f(), \"\\n\";
"
php script/bootstrap-inventory.php --check
'

Output

OK (3 tests, 13 assertions)   # BoundMethodCallableHelperRuntimeShrinkTest
OK (2 tests, 10 assertions)   # FromCallableRuntimeShrinkTest
1                             # JIT [obj,method]() FCC repro

Made with Cursor

)

Move ~330 lines of [obj,method] callable resolution from
BoundMethodCallableHelper into VM SSOT VmBoundMethodCallable; JIT helper
becomes thin trampoline. VmFromCallable now calls VM SSOT directly.

Co-authored-by: Cursor <cursoragent@cursor.com>
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.

php-in-php: JIT BoundMethodCallableHelper — route [obj,method] FCC LLVM through VmCallable PHP not ~381-line helper (#1492)

1 participant