Category
php-in-php · stdlib
Problem
readfile() VM path already uses PHP (ext/standard/readfile.php → VmFs::readfile()), but JIT/AOT still calls LLVM helper __compiler_readfile implemented in lib/JIT/Builtin/StringReadfile.php with direct open/read/write libc FFI.
Workers should route JIT lowering through the same PHP semantics (ext/standard/JitReadfile.php → shared VmFs/VmFsReadNative) and delete/shrink the standalone libc LLVM body.
php-src reference
Repro (JIT divergence)
<?php
$path = sys_get_temp_dir() . '/phpc_readfile_' . getmypid() . '.txt';
file_put_contents($path, 'abc');
$n = readfile($path);
@unlink($path);
var_export($n);
echo "\n";
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php bin/vm.php repro_readfile.php
php bin/jit.php repro_readfile.php'
Today VM uses PHP VmFs; JIT uses __compiler_readfile LLVM — parity issue is JIT lowering path, not missing builtin.
Scope (this repo)
| Layer |
Path |
| VM (source of truth) |
ext/standard/readfile.php, ext/standard/VmFs.php |
| JIT today |
ext/standard/JitReadfile.php, lib/JIT/Builtin/StringReadfile.php |
| Target |
JIT calls compiled PHP/native shim shared with VM; remove libc read loop from StringReadfile.php |
Pairs #8920 (VmFsReadNative / file_get_contents PHP path).
Done when
Related
Category
php-in-php·stdlibProblem
readfile()VM path already uses PHP (ext/standard/readfile.php→VmFs::readfile()), but JIT/AOT still calls LLVM helper__compiler_readfileimplemented inlib/JIT/Builtin/StringReadfile.phpwith directopen/read/writelibc FFI.Workers should route JIT lowering through the same PHP semantics (
ext/standard/JitReadfile.php→ sharedVmFs/VmFsReadNative) and delete/shrink the standalone libc LLVM body.php-src reference
ext/standard/streamsfuncs.c—php_readfile/php_stream_passthruRepro (JIT divergence)
Today VM uses PHP
VmFs; JIT uses__compiler_readfileLLVM — parity issue is JIT lowering path, not missing builtin.Scope (this repo)
ext/standard/readfile.php,ext/standard/VmFs.phpext/standard/JitReadfile.php,lib/JIT/Builtin/StringReadfile.phpStringReadfile.phpPairs #8920 (
VmFsReadNative/file_get_contentsPHP path).Done when
readfile()returns same byte count /falseas VM on reproreadfileis in compile unitlib/JIT/Builtin/StringReadfile.phplibc FFI removed or reduced to thin ABI trampoline./script/ci-fast.sh --filter Readfile(or new compliance PHPT) greenRelated