Category
php-in-php · runtime-shrink (#1492 , peer #31764 / #31606 / #31706 )
Problem
Always-on LibcExtern still registers libc open/close/read/write even though:
User-script file/stream I/O already routes through PHP (StreamIoJitHelper / FileGetContentsJitHelper / __compiler_* — not raw libc fd ops as the PHP builtin ABI).
Several NestedJIT leaves already declare the symbols they need module-locally (TouchLibcRuntime, JitStreamIoKernel::ensureLibc close, JitTempnamKernel, ObStorageLlvm write); the rest only need a shared ensurePosixFd() before lookup (peer ensureStdioFile php-in-php: drop always-on LibcExtern fopen/fread/fwrite/fclose after stream kernels declare module-locally (#31606 shape) #31764 ).
Symbol
NestedJIT lookupFunction consumers (sample)
Already module-local
open
SessionStorage, FileGetContentsLibc, ReadfileLibc, RandomBytes, Gethostname, TouchLibc
TouchLibc
close
same + StreamIoKernel, TempnamKernel
TouchLibc, StreamIo, Tempnam
read
SessionStorage, FileGetContentsLibc, ReadfileLibc, RandomBytes, Gethostname, SocketPairIo
—
write
SessionStorage, ReadfileLibc, ObStorage, ObWriteStdout, ProgressNote, EmbedObEcho, SocketPairIo
ObStorage
Path
Today
Target
User-script fopen/file_get_contents/readfile/…
PHP helpers / __compiler_*
unchanged
LibcExtern
always-on open/close/read/write
drop rows
NestedJIT fd leaves
rely on always-on (or local ensure)
LibcExtern::ensurePosixFd() + existing local ensures
php-src reference
php/php-src ext/standard/file.c — stream/file builtins (user-script semantics stay in PHP)
NestedJIT uses libc open/read/write/close only as thin platform ABI trampolines inside NestedJIT leaves
PHP implementation target
lib/JIT/LibcExtern.php — drop always-on rows; add ensurePosixFd()
NestedJIT consumers that still rely on always-on — call ensurePosixFd before lookup
test/unit/LibcExternDeadDeclsRuntimeShrinkTest.php (+ targeted shrink guards)
test/repro/issue_<n>_posix_fd.php — file_get_contents / echo smoke
Repro / verify
./script/phpunit.sh --filter ' LibcExternDeadDeclsRuntimeShrinkTest|LibcNameCollisionRuntimeShrinkTest'
./script/docker-exec.sh -- bash -lc ' php bin/vm.php test/repro/issue_NNNN_posix_fd.php'
./script/docker-exec.sh -- bash -lc ' php bin/jit.php test/repro/issue_NNNN_posix_fd.php'
Done when
Note
#10533 comments are locked (2500+); candidate recorded here instead of a tracker comment.
Category
php-in-php· runtime-shrink (#1492, peer #31764 / #31606 / #31706)Problem
Always-on
LibcExternstill registers libcopen/close/read/writeeven though:StreamIoJitHelper/FileGetContentsJitHelper/__compiler_*— not raw libc fd ops as the PHP builtin ABI).TouchLibcRuntime,JitStreamIoKernel::ensureLibcclose,JitTempnamKernel,ObStorageLlvmwrite); the rest only need a sharedensurePosixFd()before lookup (peerensureStdioFilephp-in-php: drop always-on LibcExtern fopen/fread/fwrite/fclose after stream kernels declare module-locally (#31606 shape) #31764).lookupFunctionconsumers (sample)openclosereadwrite__compiler_*LibcExternopen/close/read/writeLibcExtern::ensurePosixFd()+ existing local ensuresphp-src reference
ext/standard/file.c— stream/file builtins (user-script semantics stay in PHP)PHP implementation target
lib/JIT/LibcExtern.php— drop always-on rows; addensurePosixFd()ensurePosixFdbefore lookuptest/unit/LibcExternDeadDeclsRuntimeShrinkTest.php(+ targeted shrink guards)test/repro/issue_<n>_posix_fd.php— file_get_contents / echo smokeRepro / verify
Done when
LibcExternhas no'open'|'close'|'read'|'write' =>always-on rowsensurePosixFdor existing module-local ensure before lookuplib/AOT/runtime/*.cNote
#10533 comments are locked (2500+); candidate recorded here instead of a tracker comment.