Category
language
Problem (phase 2 of #146)
VM and AOT already dispatch __get, __set, __call, __callStatic, and __toString on user classes (see docs/capabilities-syntax.md — VM yes, AOT yes). JIT still deopts or aborts on undeclared property access / missing methods instead of lowering magic dispatch in LLVM IR.
Framework-style code ($obj->$name, (string) $plugin, lazy config objects) compiles under VM but bin/jit.php / MCJIT paths fail or fall back to VM for whole functions.
php-src reference
Zend/zend_object_handlers.c — zend_std_read_property, zend_std_write_property, zend_std_get_static_method, zend_std_get_method, zend_std_cast_object_tostring
Zend/zend_execute.c — ZEND_FETCH_OBJ_*, ZEND_INIT_METHOD_CALL slow paths
Repro (JIT failure today)
<?php
class Box {
private array $data = ['x' => 1];
public function __get(string $name) {
return $this->data[$name] ?? null;
}
public function __toString(): string {
return 'box';
}
}
$o = new Box();
echo $o->x, (string) $o, "\n";
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php repro.php'
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/jit.php repro.php'
Zend / VM: 1box
JIT (today): compile-time or runtime abort on unknown property x / missing __toString lowering (see JITTest magic-method skips).
Scope
lib/JIT/ — property fetch/store slow paths when declared property lookup misses (PropertyFetchHelper, RuntimeIndirectInstanceMethodCall)
lib/Compiler.php — avoid treating all dynamic $obj->prop as hard errors when class defines __get/__set
test/compliance/cases/language/magic_methods_jit.phpt
test/compliance/JITTest.php — remove or narrow VM-only skips for magic cases
Done when
Links
Category
languageProblem (phase 2 of #146)
VM and AOT already dispatch
__get,__set,__call,__callStatic, and__toStringon user classes (seedocs/capabilities-syntax.md— VM yes, AOT yes). JIT still deopts or aborts on undeclared property access / missing methods instead of lowering magic dispatch in LLVM IR.Framework-style code (
$obj->$name,(string) $plugin, lazy config objects) compiles under VM butbin/jit.php/ MCJIT paths fail or fall back to VM for whole functions.php-src reference
Zend/zend_object_handlers.c—zend_std_read_property,zend_std_write_property,zend_std_get_static_method,zend_std_get_method,zend_std_cast_object_tostringZend/zend_execute.c—ZEND_FETCH_OBJ_*,ZEND_INIT_METHOD_CALLslow pathsRepro (JIT failure today)
Zend / VM:
1boxJIT (today): compile-time or runtime abort on unknown property
x/ missing__toStringlowering (seeJITTestmagic-method skips).Scope
lib/JIT/— property fetch/store slow paths when declared property lookup misses (PropertyFetchHelper,RuntimeIndirectInstanceMethodCall)lib/Compiler.php— avoid treating all dynamic$obj->propas hard errors when class defines__get/__settest/compliance/cases/language/magic_methods_jit.phpttest/compliance/JITTest.php— remove or narrow VM-only skips for magic casesDone when
1boxunderbin/jit.phpwithout VM fallback__call/__callStaticJIT smoke passes for at least one aritydocs/capabilities-syntax.mdmagic-methods row shows JIT: yes (regenerate matrix)./script/ci-fast.sh --filter 'magic_methods_jit|MagicMethod'greenLinks
Magic methods