Category
php-in-php · runtime-shrink (#1492, peer EnvironMirror #19157 / Bz2 #20117 / rename #20028)
Problem
lib/JIT/Builtin/StringGetenv.php still gates inventory / user-script / StreamIo-defer AOT through StreamIoRuntime::shouldDeferHeavyStreamIoEmitters() → JitGetenvKernel raw libc getenv(3). Embed uses GetenvJitHelper PHP overlay (putenv-local + VmEnvEnvironNative), so thin/user-script AOT misses the overlay and duplicates libc in LLVM.
GetenvJitHelper emits as a helper-runtime unit with runtime_safe: true + init_via_global_ctor — same shape as EnvironMirrorNative / Bz2. JitVmHelperLink::ensureCompiled clears PHP_COMPILER_AOT_USER_SCRIPT during NestedJIT (#16075), so always-helper is viable.
| Mode |
Today |
Target |
| Embed / non-defer |
GetenvJitHelper bridge |
unchanged |
| StreamIo defer / user-script / inventory |
JitGetenvKernel libc |
JitVmHelperLink → GetenvJitHelper |
StringGetenvAll defer stub |
empty/minimal LLVM stub |
same helper path |
php-src reference
PHP implementation target
lib/JIT/Builtin/StringGetenv.php — always JitVmHelperLink::ensureCompiled + existing out-param bridge; drop StreamIo defer / JitGetenvKernel
lib/JIT/Builtin/StringGetenvAll.php — drop defer inventory stub; always helper bridge
- Delete
ext/standard/JitGetenvKernel.php
- Update
test/unit/GetenvJitRuntimeShrinkTest.php + spine require list
- Prelink
prelinked/helper-runtime/*/units/ext_standard_GetenvJitHelper_php/ when emitting
Repro
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
vendor/bin/phpunit test/unit/GetenvJitRuntimeShrinkTest.php
PHP_COMPILER_AOT_USER_SCRIPT=1 ./phpc build -o /tmp/getenv_aot test/fixtures/aot/cases/getenv_putenv.phpt 2>/dev/null || true
# fixture smoke:
php -r "echo \"see AotTest getenv_putenv / getenv_local_only\";"
vendor/bin/phpunit --filter getenv test/aot/AotTest.php
make bootstrap-selfhost-vm-driver-execute-probe
'
Done when
Refs #1492, #19373, #19157, #20117, #9092
Category
php-in-php· runtime-shrink (#1492, peer EnvironMirror #19157 / Bz2 #20117 / rename #20028)Problem
lib/JIT/Builtin/StringGetenv.phpstill gates inventory / user-script / StreamIo-defer AOT throughStreamIoRuntime::shouldDeferHeavyStreamIoEmitters()→JitGetenvKernelraw libcgetenv(3). Embed usesGetenvJitHelperPHP overlay (putenv-local +VmEnvEnvironNative), so thin/user-script AOT misses the overlay and duplicates libc in LLVM.GetenvJitHelperemits as a helper-runtime unit withruntime_safe: true+init_via_global_ctor— same shape as EnvironMirrorNative / Bz2.JitVmHelperLink::ensureCompiledclearsPHP_COMPILER_AOT_USER_SCRIPTduring NestedJIT (#16075), so always-helper is viable.GetenvJitHelperbridgeJitGetenvKernellibcJitVmHelperLink→GetenvJitHelperStringGetenvAlldefer stubphp-src reference
zif_getenv/zif_putenvPHP implementation target
lib/JIT/Builtin/StringGetenv.php— alwaysJitVmHelperLink::ensureCompiled+ existing out-param bridge; drop StreamIo defer /JitGetenvKernellib/JIT/Builtin/StringGetenvAll.php— drop defer inventory stub; always helper bridgeext/standard/JitGetenvKernel.phptest/unit/GetenvJitRuntimeShrinkTest.php+ spine require listprelinked/helper-runtime/*/units/ext_standard_GetenvJitHelper_php/when emittingRepro
Done when
JitGetenvKernel.phpdeletedUserScriptAotDeferNestedJit/shouldDeferHeavyStreamIoEmittersremoved from getenv bridge pathmake bootstrap-selfhost-vm-driver-execute-probegreenRefs #1492, #19373, #19157, #20117, #9092