Category
php-in-php · #1492 self-host / shrink C+LLVM runtime
Problem
Catchable Error and TypeError throw paths in JIT/AOT are implemented as large LLVM modules:
lib/JIT/Builtin/ErrorRaise.php (~389 lines)
lib/JIT/Builtin/TypeErrorRaise.php (~531 lines)
lib/JIT/ErrorBridge.php and lib/JIT/ExceptionBridge.php note these replaced deleted lib/AOT/runtime/phpc_error_raise.c / phpc_type_error_raise.c, but the replacement is still LLVM-first, not compiled PHP semantics.
VM already materializes Error / TypeError in lib/VM/ — JIT should call the same helpers as ExceptionThrowRuntime migration (#9679) and TryCatchHelper (#9663).
php-src reference
Repro (LLVM bodies present)
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
wc -l lib/JIT/Builtin/ErrorRaise.php lib/JIT/Builtin/TypeErrorRaise.php
php bin/jit.php -r "
class C { public readonly int \$x; }
try { (new C(1))->x = 2; } catch (Error \$e) { echo get_class(\$e), \"\\n\"; }
" 2>&1 | head -5
'
Readonly guard currently routes through ReadonlyBridge / ErrorRaise::emitRaise LLVM, not VmException PHP.
Scope (this repo)
| Shrink LLVM |
Grow PHP |
ErrorRaise.php, TypeErrorRaise.php message/unwind IR |
lib/VM/VmException.php or shared VmErrorThrow.php helper |
lib/JIT/ErrorBridge.php, lib/JIT/ExceptionBridge.php indirection |
lib/JIT/Builtin/ExceptionThrowRuntime.php pattern — compiled throw helper |
Call sites: ListUnpackHelper, PropertyHookDispatch, StringFormatJit, … |
Single SSOT for pending-error buffer semantics (#5373) |
Do not grow runtime/*.c. Delete LLVM table branches when PHP path is linked.
Done when
Verification
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter ReadonlyPropertyWrite'
make bootstrap-selfhost-vm-driver-execute-probe
Related
Category
php-in-php· #1492 self-host / shrink C+LLVM runtimeProblem
Catchable
ErrorandTypeErrorthrow paths in JIT/AOT are implemented as large LLVM modules:lib/JIT/Builtin/ErrorRaise.php(~389 lines)lib/JIT/Builtin/TypeErrorRaise.php(~531 lines)lib/JIT/ErrorBridge.phpandlib/JIT/ExceptionBridge.phpnote these replaced deletedlib/AOT/runtime/phpc_error_raise.c/phpc_type_error_raise.c, but the replacement is still LLVM-first, not compiled PHP semantics.VM already materializes
Error/TypeErrorinlib/VM/— JIT should call the same helpers asExceptionThrowRuntimemigration (#9679) andTryCatchHelper(#9663).php-src reference
Zend/zend_exceptions.c—zend_throw_error,zend_throw_exceptionZend/zend_execute.c—ZEND_THROW/ catchable error unwindRepro (LLVM bodies present)
Readonly guard currently routes through
ReadonlyBridge/ErrorRaise::emitRaiseLLVM, notVmExceptionPHP.Scope (this repo)
ErrorRaise.php,TypeErrorRaise.phpmessage/unwind IRlib/VM/VmException.phpor sharedVmErrorThrow.phphelperlib/JIT/ErrorBridge.php,lib/JIT/ExceptionBridge.phpindirectionlib/JIT/Builtin/ExceptionThrowRuntime.phppattern — compiled throw helperListUnpackHelper,PropertyHookDispatch,StringFormatJit, …Do not grow
runtime/*.c. Delete LLVM table branches when PHP path is linked.Done when
readonlywrite,TypeErrorunpack, builtin guards) use compiled PHP throw helper on JIT and AOT standaloneErrorRaise.php+TypeErrorRaise.phpcombined LLVM drops materially; PR cites lines removed./script/ci-fast.sh --filter ErrorRaise/ exception compliance subset greenReadonlyRaise), php-in-php: JIT ExceptionHandlerJitRuntime + TryCatchHelper — route try/catch through VmException PHP not ~1.5k-line LLVM (#1492) #9663 (try/catch), php-in-php: JIT ExceptionThrowRuntime — route throw/Object throw through VmException PHP not LLVM unwind (#1492) #9679 (Object throw)Verification
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter ReadonlyPropertyWrite' make bootstrap-selfhost-vm-driver-execute-probeRelated