Category
language
Problem
#3196 closed VM support for class constants initialized with new (PHP 8.3 object constants). Capability row class_const_object remains JIT=no / AOT=no. JIT/AOT must materialize immortal object constants at class init and return shared identity on Class::CONST fetch — same as Zend compile-time constant folding.
php-src reference
Repro
<?php
class C {
public const X = new stdClass();
}
echo (C::X === C::X) ? "1\n" : "0\n";
echo (C::X instanceof stdClass) ? "1\n" : "0\n";
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php bin/vm.php repro.php
php bin/jit.php repro.php 2>&1
'
Expected (Zend): two lines of 1 (same object identity). VM (#3196): ✅. JIT/AOT: gap — compile or runtime error / wrong identity.
Scope
| Layer |
Files |
| VM reference |
lib/VM/ClassConstMaterializer.php, lib/Compiler.php const-init |
| JIT |
Emit immortal object handle in class metadata; TYPE_CLASS_CONST_FETCH loads shared slot |
| AOT |
Link constant object section / preinit in VMContext |
| Tests |
test/compliance/cases/language/class_const_object_jit.phpt |
Done when
Related
Category
languageProblem
#3196 closed VM support for class constants initialized with
new(PHP 8.3 object constants). Capability rowclass_const_objectremains JIT=no / AOT=no. JIT/AOT must materialize immortal object constants at class init and return shared identity onClass::CONSTfetch — same as Zend compile-time constant folding.php-src reference
Zend/zend_compile.c—zend_compile_const_expr, object constant validationZend/zend_constants.c— constant value materialization and persistenceRepro
Expected (Zend): two lines of
1(same object identity). VM (#3196): ✅. JIT/AOT: gap — compile or runtime error / wrong identity.Scope
lib/VM/ClassConstMaterializer.php,lib/Compiler.phpconst-initTYPE_CLASS_CONST_FETCHloads shared slotVMContexttest/compliance/cases/language/class_const_object_jit.phptDone when
1/1matching VMclass_const_objectrow: jit/aot true in capability syntax matrixnew— identity stable across fetchesRelated