Repository navigation
php-in-php: getrusage() — delete phpc_getrusage.c (~78 lines), native VmProcess without host getrusage() #5388
Description
Activity
- addedenhancementNew feature or requestNew feature or requestphase-0:FoundationPhase 0 – foundation & DevExPhase 0 – foundation & DevExphase-4:stdlibPhase 4 – stdlib for web appsPhase 4 – stdlib for web appsarea:compilerCompiler / CFG / JITCompiler / CFG / JITarea:vmVirtual machineVirtual machineimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimSpec complete: repro, php-src ref, done-when — safe for workers to claim
on Jun 4, 2026 claim: PHP Runtime → PHP — starting this run (#5388 getrusage: delete phpc_getrusage.c, LLVM from StringGetrusage.php).
- added a commit that references this issue
on Jun 5, 2026 Merged via #6253.
C removed:
lib/AOT/runtime/phpc_getrusage.c(78 lines) — unlinked fromlib/AOT/Linker.php.PHP path:
lib/JIT/Builtin/StringGetrusage.phpnow emits LLVM for__compiler_getrusage(libcgetrusage(2)+ hashtable field mapping), wired viaStringGetrusage::ensureLinked()inType.php. FollowsStringGettimeofdaypattern; drops JIT-time C bitcode compilation.Verification:
vendor/bin/phpunit test/unit/JIT/StringGetrusageRuntimeStandaloneTest.php— OKvendor/bin/phpunit --filter getrusage— VM compliance OKphp bin/vm.php test/repro/getrusage.php→okphp bin/jit.php test/repro/getrusage.php→ok
Follow-up: VmProcess still delegates to host
\getrusage()on VM path; #4600 parity (numeric-stringwho, TypeError messages) remains open.- added a commit that references this issue
on Jun 10, 2026 Merged via #7858.
VM phase:
VmGetrusageNativeroutes VMgetrusage()through libc FFI (getrusage(2)) instead of host\getrusage()delegation — same field layout asStringGetrusageJIT/AOT. LLVM lowering now normalizeswho=1→RUSAGE_CHILDRENper php-srcmicrotime.c.Verification:
php bin/vm.php test/repro/getrusage.php→ okvendor/bin/phpunit --filter VmGetrusageNativeTest→ OK (5 tests)vendor/bin/phpunit --filter "VMTest::testCases.*getrusage"→ OK (5 PHPTs, VM + JIT)vendor/bin/phpunit --filter GetrusageJITTest→ OK
No new C runtime; host fallback only when FFI disabled.
Category
php-in-php|stdlib|bootstrapProblem
getrusage()is implemented in PHP (ext/standard/getrusage.php,VmProcess.php,JitGetrusage.php) but JIT/AOT still call__compiler_getrusageinlib/AOT/runtime/phpc_getrusage.c(~78 lines). VMVmProcess::getrusage()delegates to host\getrusage()— bootstrap/self-host must not depend on Zend for process stats.Parity gaps tracked separately in #4600 (numeric-string
who, TypeError messages).php-src reference
ext/standard/basic_functions.c—PHP_FUNCTION(getrusage),whovalidationext/standard/php_getrusage.h— libcgetrusage(2)wrapperRepro (failure today — host + C runtime)
lib/AOT/runtime/phpc_getrusage.cpresentVmProcess::getrusageuses\getrusage()Scope (this repo)
ext/standard/VmProcess.phpgetrusagevia thin FFI/trampoline or compile PHP helper through pipelineext/standard/JitGetrusage.php,lib/JIT/Builtin/StringGetrusage.php__compiler_getrusageClib/AOT/Linker.phpphpc_getrusage.cfrom runtime objectslib/AOT/runtime/phpc_getrusage.cPHP-in-PHP: port field mapping from php-src into
ext/standard/; keep C only if unavoidable ABI (document in PR).Done when
phpc_getrusage.cdeleted; no__compiler_getrusagesymbol in linked AOT binarygetrusage()VM + JIT + AOT match Zend ontest/compliance/cases/stdlib/getrusage*.phptmake bootstrap-selfhost-helloworld/ inventory unchanged (no new C logic)Verification
Links