Skip to content

JIT: per-run superglobal refresh for bin/jit.php (#642)#653

Merged
PurHur merged 1 commit into
masterfrom
issue-642-jit-superglobal-refresh
May 22, 2026
Merged

JIT: per-run superglobal refresh for bin/jit.php (#642)#653
PurHur merged 1 commit into
masterfrom
issue-642-jit-superglobal-refresh

Conversation

@PurHur
Copy link
Copy Markdown
Owner

@PurHur PurHur commented May 22, 2026

Summary

  • Export CLI -q/-p into QUERY_STRING / REQUEST_BODY CGI env via Superglobals::exportCgiEnvironment().
  • Before each bin/jit.php run, Runtime::syncJitSuperglobals() repopulates the VM and re-runs JIT __init__ so sg_* tables match the current request without recompiling LLVM IR.
  • MCJIT embed mode no longer folds superglobal string reads at compile time, so refreshed tables are observed at runtime.

Test plan

  • vendor/bin/phpunit --filter SuperglobalsExportCgiTest (Docker tar pipe)
  • vendor/bin/phpunit --filter JitSuperglobalRefreshTest (requires working MCJIT; harness currently segfaults on jit-runtime-probe — same on master)
  • Manual: php bin/jit.php -q 'name=Alice' examples/001-SimpleWeb/example.php then Bob

Closes #642

Made with Cursor

Sync MCJIT sg_* tables from the VM before each bin/jit.php run, export
-q/-p into CGI env, and skip compile-time superglobal folding in embed mode
so back-to-back invocations and repeated runs see fresh $_REQUEST data.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur PurHur merged commit fc0224d into master May 22, 2026
@PurHur PurHur deleted the issue-642-jit-superglobal-refresh branch May 22, 2026 19:58
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.

JIT: Per-run superglobal refresh for bin/jit.php (-q/-p between invocations)

1 participant