Category
php-in-php · language
Problem
Late static binding (static::class, static::method(), new static) uses lib/JIT/LateStaticBindingHelper.php (~152 LOC) with a module-global phpc_late_static_class_id LLVM global and standalone-JIT special cases (#4792).
VM resolves called scope via PHP frame metadata (get_called_scope parity). LLVM path duplicates this and is fragile for self-host/AOT.
php-src reference
Repro
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php bin/vm.php -r "class B{public static function c():string{return static::class;}} class D extends B{} echo D::c();" 2>&1
php bin/jit.php -r "class B{public static function c():string{return static::class;}} class D extends B{} echo D::c();" 2>&1
wc -l lib/JIT/LateStaticBindingHelper.php
'
| Engine |
D::c() via static::class |
| Zend |
'D' |
VM -r |
'D' ✅ (verify) |
| JIT |
verify matches; refactor to PHP trampoline |
Scope (PHP-in-PHP)
| Path |
Work |
lib/JIT/LateStaticBindingHelper.php |
Trampoline to VM called_scope resolver |
lib/VM/LateStaticBinding.php |
SSOT for scope id → class name |
lib/JIT/LateStaticBindingHelper.php |
Remove phpc_late_static_class_id global when PHP path sufficient |
Done when
Related
Category
php-in-php·languageProblem
Late static binding (
static::class,static::method(),new static) useslib/JIT/LateStaticBindingHelper.php(~152 LOC) with a module-globalphpc_late_static_class_idLLVM global and standalone-JIT special cases (#4792).VM resolves called scope via PHP frame metadata (
get_called_scopeparity). LLVM path duplicates this and is fragile for self-host/AOT.php-src reference
Zend/zend_execute.c—get_called_scope(),ZEND_FETCH_CLASS,ZEND_INIT_STATIC_METHOD_CALLZend/zend_compile.c—static::compileRepro
D::c()viastatic::class'D'-r'D'✅ (verify)Scope (PHP-in-PHP)
lib/JIT/LateStaticBindingHelper.phpcalled_scoperesolverlib/VM/LateStaticBinding.phplib/JIT/LateStaticBindingHelper.phpphpc_late_static_class_idglobal when PHP path sufficientDone when
static::class,static::method(),new staticmatch VM on repro + compliance cases./script/ci-fast.sh --filter LateStaticgreenRelated