Category
php-in-php · runtime
Problem
Nullsafe property/method access ($obj?->prop, $obj?->m()) lowers through lib/JIT/NullsafeHelper.php (~96 lines LLVM) duplicating short-circuit semantics already expressible in VM PHP. Per #1492 PHP-in-PHP strategy, JIT should compileUnit() a PHP helper and keep LLVM as a thin trampoline — shrink parallel LLVM maintenance.
php-src reference
Repro (migration metric)
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
wc -l lib/JIT/NullsafeHelper.php
grep -c "function " lib/JIT/NullsafeHelper.php
php bin/jit.php -r "
class C { public function f(): int { return 42; } }
\$c = null;
var_dump(\$c?->f());
\$c = new C();
var_dump(\$c?->f());
" 2>/dev/null
'
Today: LLVM bodies in NullsafeHelper.php; post-migration should delegate to compiled PHP like #10078 InstanceOfHelper bridge pattern.
Scope (this repo)
| Path |
Work |
lib/JIT/NullsafeHelper.php |
Replace LLVM short-circuit with compileUnit() of PHP helper |
lib/VM/Nullsafe.php (or new NullsafeJitHelper.php) |
SSOT semantics shared with VM |
lib/JIT/Builtin/Type.php |
Trampoline registration |
| Tests |
Existing nullsafe JIT compliance PHPTs stay green |
Forbidden: growing runtime/*.c for nullsafe — PHP lowering only.
Done when
Related
Category
php-in-php·runtimeProblem
Nullsafe property/method access (
$obj?->prop,$obj?->m()) lowers throughlib/JIT/NullsafeHelper.php(~96 lines LLVM) duplicating short-circuit semantics already expressible in VM PHP. Per #1492 PHP-in-PHP strategy, JIT shouldcompileUnit()a PHP helper and keep LLVM as a thin trampoline — shrink parallel LLVM maintenance.php-src reference
Zend/zend_compile.c— nullsafe opcodes (ZEND_JMP_NULLchain)lib/VM/Nullsafe.php(or equivalent nullsafe dispatch used bybin/vm.php)Repro (migration metric)
Today: LLVM bodies in
NullsafeHelper.php; post-migration should delegate to compiled PHP like #10078 InstanceOfHelper bridge pattern.Scope (this repo)
lib/JIT/NullsafeHelper.phpcompileUnit()of PHP helperlib/VM/Nullsafe.php(or newNullsafeJitHelper.php)lib/JIT/Builtin/Type.phpForbidden: growing
runtime/*.cfor nullsafe — PHP lowering only.Done when
NullsafeHelper.phpLLVM line count drops to trampolines + ABI glue (target ≥50% reduction)./script/ci-fast.shgreen; no new C symbols inruntime/Related