Category
php-in-php · php-src-strict · compile/runtime shared
Problem
lib/JIT/ScalarDimFetchHelper.php (~44 lines) emits inline LLVM that calls __compiler_trigger_error with hard-coded warning strings for ZEND_FETCH_DIM_R on scalar containers (int/float/string/bool/null). VM implements the same guard in PHP with shared message text (#4867).
Duplicated LLVM warning paths drift from php-src and block shrinking the JIT error layer toward compiled PHP helpers (#9778, #9679).
php-src reference
Repro (LLVM path today)
<?php
$x = 42;
var_export($x[0]);
echo "\n";
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php -r "\$x=42; var_export(\$x[0]); echo \"\\n\";" 2>&1 | head -3
php bin/vm.php -r "\$x=42; var_export(\$x[0]); echo \"\\n\";" 2>&1 | head -3
php bin/jit.php -r "\$x=42; var_export(\$x[0]); echo \"\\n\";" 2>&1 | head -5
wc -l lib/JIT/ScalarDimFetchHelper.php
'
Expected: Warning Trying to access array offset on value of type int + NULL on VM/JIT/AOT (php-src-strict).
Scope (this repo)
| Shrink LLVM |
Grow PHP |
lib/JIT/ScalarDimFetchHelper.php emitArrayOffsetWarning() IR |
Shared VM helper (e.g. extend lib/VM/ErrorReporter.php or dim-fetch module) |
__compiler_trigger_error calls from dim fetch |
Thin JIT trampoline calling compiled PHP warning+null helper |
Call sites in lib/JIT.php scalar dim read lowering |
VM/JIT/AOT message text SSOT |
Do not grow runtime/*.c. Delete LLVM warning branches when PHP path is linked.
Done when
Verification
make bootstrap-selfhost-vm-driver-execute-probe
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter DimFetch'
Related
Category
php-in-php· php-src-strict · compile/runtime sharedProblem
lib/JIT/ScalarDimFetchHelper.php(~44 lines) emits inline LLVM that calls__compiler_trigger_errorwith hard-coded warning strings forZEND_FETCH_DIM_Ron scalar containers (int/float/string/bool/null). VM implements the same guard in PHP with shared message text (#4867).Duplicated LLVM warning paths drift from php-src and block shrinking the JIT error layer toward compiled PHP helpers (#9778, #9679).
php-src reference
Zend/zend_execute.c—ZEND_FETCH_DIM_Ron non-array/object →E_WARNING+nullZend/zend_operators.c— type label in warning messageRepro (LLVM path today)
Expected: Warning
Trying to access array offset on value of type int+NULLon VM/JIT/AOT (php-src-strict).Scope (this repo)
lib/JIT/ScalarDimFetchHelper.phpemitArrayOffsetWarning()IRlib/VM/ErrorReporter.phpor dim-fetch module)__compiler_trigger_errorcalls from dim fetchlib/JIT.phpscalar dim read loweringDo not grow
runtime/*.c. Delete LLVM warning branches when PHP path is linked.Done when
ScalarDimFetchHelper.phpshrinks to thin trampoline; PR cites lines removed./script/ci-fast.sh --filter ScalarDimor existing dim-fetch compliance subset greenVerification
make bootstrap-selfhost-vm-driver-execute-probe ./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter DimFetch'Related