Skip to content

php-in-php: class_exists()/interface_exists() JIT via VmReflection PHP (#16185)#16186

Merged
PurHur merged 1 commit into
masterfrom
agent/runtime-php-class-interface-exists
Jul 4, 2026
Merged

php-in-php: class_exists()/interface_exists() JIT via VmReflection PHP (#16185)#16186
PurHur merged 1 commit into
masterfrom
agent/runtime-php-class-interface-exists

Conversation

@PurHur

@PurHur PurHur commented Jul 4, 2026

Copy link
Copy Markdown
Owner

Summary

Migrates class_exists() and interface_exists() JIT runtime paths from inline LLVM strcasecmp loops to compiled PHP helpers, matching the pattern merged in #16173 (trait_exists).

  • PHP SSOT: VmReflection::classExists() / VmReflection::interfaceExists()
  • JIT bridges: ClassExistsJitHelper + InterfaceExistsJitHelper via StringClassExists / StringInterfaceExists (JitVmHelperLink)
  • Shrink: JitClassExists.php 56→31 LOC (−25); JitInterfaceExists.php 58→32 LOC (−26); compile-time literal fast paths unchanged (ReflectionBuiltinHelper)
  • Kept: JitClassExists::stringDataPtr() — still used by JitFilterId, JitClassUses, JitGetClassMethods
  • No new C in lib/AOT/runtime/ (floor unchanged: phpc_progress.c SIGSEGV handler only)

Closes #16185

Verification

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter ClassInterfaceExistsRuntimeShrinkTest'
# OK (6 tests, 22 assertions)

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit test/compliance/JITTest.php --filter class_exists_runtime'
# OK (2 tests, 2 assertions)

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit test/compliance/JITTest.php --filter builtin_interface_exists'
# OK (2 tests, 2 assertions)

make bootstrap-selfhost-vm-driver-execute-probe
# bootstrap-selfhost-vm-driver-execute-probe: OK

php-src reference

  • ext/standard/basic_functions.cPHP_FUNCTION(class_exists) / PHP_FUNCTION(interface_exists)

Made with Cursor

#16185)

Route runtime JIT paths through ClassExistsJitHelper and InterfaceExistsJitHelper
instead of inline strcasecmp LLVM loops; keep JitClassExists::stringDataPtr for
other introspection JIT users.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur PurHur merged commit d87ef2d into master Jul 4, 2026
1 check failed
@PurHur PurHur deleted the agent/runtime-php-class-interface-exists branch July 4, 2026 20:12
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: class_exists()/interface_exists() JIT via ClassExistsJitHelper/InterfaceExistsJitHelper PHP — drop inline strcasecmp LLVM (#1492)

1 participant