Skip to content

php-in-php: VmGetrusageNative libc FFI for VM getrusage() (#5388) - #7858

Merged
PurHur merged 1 commit into
masterfrom
agent/runtime-php-getrusage-vm-native-5388
Jun 10, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/runtime-php-getrusage-vm-native-5388

Conversation

@PurHur

@PurHur PurHur commented Jun 10, 2026

Copy link
Copy Markdown
Owner

Summary

Closes #5388 (VM phase).

php-src reference

  • ext/standard/microtime.c — PHP_FUNCTION(getrusage)

PHP implementation

  • ext/standard/VmGetrusageNative.php — VM SSOT
  • lib/JIT/Builtin/StringGetrusage.php — JIT/AOT (unchanged ABI, who normalization fix)

Verification

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php test/repro/getrusage.php'
# ok

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter VmGetrusageNativeTest'
# OK (5 tests, 15 assertions)

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter "VMTest::testCases.*getrusage"'
# OK (5 tests) — VM + JIT compliance getrusage PHPTs

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter "GetrusageJITTest|StringGetrusageRuntimeStandaloneTest"'
# OK (3 tests)

Note: AotTest::testCases getrusage segfaults on master too (pre-existing AOT execute issue, not introduced here).

Made with Cursor

Route VM getrusage() through VmGetrusageNative (libc getrusage via FFI)
instead of host Zend delegation, matching StringGetrusage JIT/AOT and the
VmMemory/VmStatNative bootstrap pattern. Normalize who=1 to RUSAGE_CHILDREN
in LLVM lowering for php-src parity.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit 44bf399 into master Jun 10, 2026
@PurHur
PurHur deleted the agent/runtime-php-getrusage-vm-native-5388 branch June 10, 2026 08:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

php-in-php: getrusage() — delete phpc_getrusage.c (~78 lines), native VmProcess without host getrusage()

1 participant