Category
php-in-php | stdlib
Problem
Directory and path builtins (glob, scandir, chmod, chown, chgrp, touch, utime, …) have PHP VM paths (ext/standard/VmFsGlob.php, VmFs.php) but AOT/JIT still link a large C helper table:
lib/AOT/runtime/phpc_fs_dir.c — ~760 lines (glob/scandir/chmod/…)
- Registered in
lib/AOT/Linker.php (phpc_fs_dir.c)
This duplicates logic already moving PHP-ward and blocks shrinking the C runtime per #1492 / PHP-in-PHP strategy.
php-src reference
Repro (C dependency today)
grep phpc_fs_dir lib/AOT/Linker.php
wc -l lib/AOT/runtime/phpc_fs_dir.c
# 760 lib/AOT/runtime/phpc_fs_dir.c
./script/docker-exec.sh bash -lc 'source script/ci-defaults.env && make bootstrap-selfhost-link'
# links phpc_fs_dir.o even when VM uses VmFsGlob.php
VM glob() already works via FFI (ext/standard/VmFsGlob.php, #4859); AOT should lower to the same PHP/FFI path, not __phpc_glob_vec C.
Scope (this repo)
| Layer |
Path |
| Delete C |
lib/AOT/runtime/phpc_fs_dir.c, remove from lib/AOT/Linker.php |
| JIT/AOT |
lib/JIT/Builtin/ handlers calling VmFsGlob / VmFs (thin libc FFI only) |
| VM |
keep ext/standard/glob_.php, scandir.php, chmod_.php, … |
| Tests |
existing JIT/AOT PHPT for glob/scandir; add chmod/touch if missing |
| Matrix |
php script/capability-matrix.php |
Done when
Related
Category
php-in-php|stdlibProblem
Directory and path builtins (
glob,scandir,chmod,chown,chgrp,touch,utime, …) have PHP VM paths (ext/standard/VmFsGlob.php,VmFs.php) but AOT/JIT still link a large C helper table:lib/AOT/runtime/phpc_fs_dir.c— ~760 lines (glob/scandir/chmod/…)lib/AOT/Linker.php(phpc_fs_dir.c)This duplicates logic already moving PHP-ward and blocks shrinking the C runtime per #1492 / PHP-in-PHP strategy.
php-src reference
ext/standard/dir.c—glob,scandirext/standard/filestat.c—chmod,touch,utimeext/standard/+ JIT loweringRepro (C dependency today)
VM
glob()already works via FFI (ext/standard/VmFsGlob.php, #4859); AOT should lower to the same PHP/FFI path, not__phpc_glob_vecC.Scope (this repo)
lib/AOT/runtime/phpc_fs_dir.c, remove fromlib/AOT/Linker.phplib/JIT/Builtin/handlers callingVmFsGlob/VmFs(thin libc FFI only)ext/standard/glob_.php,scandir.php,chmod_.php, …php script/capability-matrix.phpDone when
phpc_fs_dir.cremoved;~760 lines deleted fromruntime/`__phpc_glob_vec/ C dir helpersglob(),scandir(),chmod()parity tests green on VM + AOT./script/ci-fast.sh --filter 'Glob|Scandir|Chmod'green (or targeted PHPT names)runtime/*.c— libc calls stay in PHP FFI shimsRelated