Category
php-in-php · runtime-shrink (#1492, follow #19339 FGC / #19966 / #20256 handoff)
Problem
StringFilePutContents / StringReadfile still fork isThinStandaloneAotMain() → Jit*Libc while embed uses helpers. Helpers call phpc_*_kernel which re-emits the same libc. Always-helper (FGC #19339 shape) was blocked because VmFsWritePure::write() calls host \file_put_contents(), which NestedJIT lowers back into __compiler_file_put_contents → helper → recursion (writes fail / return 0).
| Mode |
Today |
Target |
| Embed / non-thin |
Helper → phpc_*_kernel libc |
Helper → VmFs::* (FGC/Unlink shape) |
| Thin standalone AOT |
Direct Jit*Libc on ABI |
Same helper bridge (no thin fork) |
VmFsWritePure |
\file_put_contents (recurses under NestedJIT) |
fopen/fwrite/fclose (StreamIo / no FPC ABI) |
php-src reference
PHP implementation target
ext/standard/VmFsWritePure.php — rewrite without \file_put_contents (fopen/fwrite/flock/fclose; keep APPEND + LOCK_EX)
ext/standard/FilePutContentsJitHelper.php — VmFs::filePutContents (false→-1)
ext/standard/ReadfileJitHelper.php — VmFs::readfile (false→-1)
lib/JIT/Builtin/StringFilePutContents.php / StringReadfile.php — always JitVmHelperLink; drop implementLibcBody / isThinStandaloneAotMain
- Delete
JitFilePutContentsLibc.php, JitReadfileLibc.php, phpc_file_put_contents_kernel.php, phpc_readfile_kernel.php; drop Module + spine requires
- Update
FilePutContentsRuntimeShrinkTest / ReadfileRuntimeShrinkTest
Repro
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
vendor/bin/phpunit test/unit/FilePutContentsRuntimeShrinkTest.php test/unit/ReadfileRuntimeShrinkTest.php
vendor/bin/phpunit test/aot/AotTest.php --filter file_put_contents
vendor/bin/phpunit test/aot/AotTest.php --filter readfile
PHP_COMPILER_HELPER_RUNTIME_O=1 PHP_COMPILER_AOT_USER_SCRIPT=1 ./phpc build -o /tmp/fpc-aot test/fixtures/aot/cases/file_put_contents.phpt
make bootstrap-selfhost-vm-driver-execute-probe
php script/bootstrap-inventory.php --check
'
Done when
Refs #1492, #19339, #19966, #20256
Category
php-in-php· runtime-shrink (#1492, follow #19339 FGC / #19966 / #20256 handoff)Problem
StringFilePutContents/StringReadfilestill forkisThinStandaloneAotMain()→Jit*Libcwhile embed uses helpers. Helpers callphpc_*_kernelwhich re-emits the same libc. Always-helper (FGC #19339 shape) was blocked becauseVmFsWritePure::write()calls host\file_put_contents(), which NestedJIT lowers back into__compiler_file_put_contents→ helper → recursion (writes fail / return0).phpc_*_kernellibcVmFs::*(FGC/Unlink shape)Jit*Libcon ABIVmFsWritePure\file_put_contents(recurses under NestedJIT)fopen/fwrite/fclose(StreamIo / no FPC ABI)php-src reference
php_file_put_contentsphp_stream_passthruPHP implementation target
ext/standard/VmFsWritePure.php— rewrite without\file_put_contents(fopen/fwrite/flock/fclose; keep APPEND + LOCK_EX)ext/standard/FilePutContentsJitHelper.php—VmFs::filePutContents(false→-1)ext/standard/ReadfileJitHelper.php—VmFs::readfile(false→-1)lib/JIT/Builtin/StringFilePutContents.php/StringReadfile.php— alwaysJitVmHelperLink; dropimplementLibcBody/isThinStandaloneAotMainJitFilePutContentsLibc.php,JitReadfileLibc.php,phpc_file_put_contents_kernel.php,phpc_readfile_kernel.php; drop Module + spine requiresFilePutContentsRuntimeShrinkTest/ReadfileRuntimeShrinkTestRepro
Done when
VmFsWritePureno longer calls\file_put_contentsJit*Libc+phpc_*_kernelfiles deletedisThinStandaloneAotMain/implementLibcBodyon FPC/readfile ABI pathVmFs; shrink + AOT fixtures greenmake bootstrap-selfhost-vm-driver-execute-probegreenRefs #1492, #19339, #19966, #20256