Skip to content

php-in-php: route time() through TimeJitHelper; drop LibcExtern time (#30332) - #30336

Merged
PurHur merged 1 commit into
masterfrom
agent/runtime-php-time-30332
Aug 11, 2026
Merged

php-in-php: route time() through TimeJitHelper; drop LibcExtern time (#30332)#30336
PurHur merged 1 commit into
masterfrom
agent/runtime-php-time-30332

Conversation

@PurHur

@PurHur PurHur commented Aug 11, 2026

Copy link
Copy Markdown
Owner

Summary

C / ABI shrink

  • lib/JIT/LibcExtern.php: removed 'time' => decl (−1 libc surface row).
  • ext/standard/JitDate.php: removed inline lookupFunction('time') body (−~10 lines LLVM call path).

php-src reference

PHP implementation

  • lib/JIT/Builtin/StringTime.php — bridge
  • ext/standard/TimeJitHelper.php — helper peel
  • ext/standard/JitTimeKernel.php — NestedJIT leaf
  • Spine + inventory 7364→7367

Test plan / verification (exact)

php script/bootstrap-inventory.php --check
# OK 7367/7367
php script/check-selfhost-spine-coverage-sync.php
# OK (spine covers all 7367 inventory files, …)
php -d memory_limit=512M vendor/bin/phpunit test/unit/TimeRuntimeShrinkTest.php
# OK (8 tests, 27 assertions)
php -d memory_limit=512M vendor/bin/phpunit test/unit/LibcExternDeadDeclsRuntimeShrinkTest.php
# OK (4 tests, 42 assertions)
php bin/vm.php -r 'echo time(), "\n";'   # matches host time()
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
cat > /tmp/time_smoke.php <<'"'"'PHP'"'"'
<?php
$t = time();
echo is_int($t) ? "int\n" : "badtype\n";
echo ($t > 946684800) ? "ok\n" : "low\n";
PHP
./phpc build -o /tmp/time_smoke /tmp/time_smoke.php && /tmp/time_smoke
make bootstrap-selfhost-vm-driver-execute-probe
'
# AOT: int / ok
# bootstrap-selfhost-vm-driver-execute-probe: OK

Not covered: full bootstrap-selfhost-link native gen-0 (falls back to Zend — #28998 exclusive r4); north-star5-verify --strict.

Made with Cursor

…30332)

Replace JitDate libc time(2) with JitVmHelperLink + NestedJIT-safe PHP helper
(microtime #29405 shape) so AOT time() is PHP SSOT and LibcExtern sheds another decl.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit b3cac5b into master Aug 11, 2026
0 of 2 checks passed
@PurHur
PurHur deleted the agent/runtime-php-time-30332 branch August 11, 2026 18:24
PurHur added a commit that referenced this pull request Aug 11, 2026
…#30323) (#30343)

Restore user_release_ready after SocketAtmark/Close/Create fingerprint drift and publish the new TimeJitHelper unit from #30336.

Co-authored-by: PurHur <PurHur@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
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: JitDate::time libc time(2) → JitVmHelperLink + TimeJitHelper PHP (microtime #29405 shape)

1 participant