Skip to content

php-in-php: JIT RewriteVarsRuntime — route output_add_rewrite_var through VmWeb PHP not LLVM globals (#1492) #9477

Description

@PurHur

Category

php-in-php · stdlib · web runtime (#1492)

Problem

Mod-rewrite output var registration (output_add_rewrite_var(), output_reset_rewrite_vars()) has VM implementations in ext/standard/ backed by PHPCompiler\Web\ResponseContext, but JIT/AOT still emit lib/JIT/Builtin/RewriteVarsRuntime.php LLVM that mirrors a request-scoped global hashtable (phpc_rewrite_vars).

Duplicated semantics risk drift for web/AOT builds and extend C-style globals instead of PHP-owned state.

php-src reference

Repro

<?php
output_add_rewrite_var('SESSIONID', 'abc');
output_add_rewrite_var('NAME', 'value');
echo "ok\n";
./script/docker-exec.sh -- php bin/vm.php -r "output_add_rewrite_var('A','1'); echo 'ok';"
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/jit.php -r "output_add_rewrite_var('"'"'A'"'"','"'"'1'"'"'); echo '"'"'ok'"'"';"'

VM path passes today; JIT must call the same PHP helper rather than LLVM table walks.

Scope (this repo)

Layer Path
VM SSOT ext/standard/output_add_rewrite_var.php, output_reset_rewrite_vars.php, lib/Web/ResponseContext.php
LLVM today lib/JIT/Builtin/RewriteVarsRuntime.php
Wire-up JIT builtin registration → PHP trampoline; delete LLVM bodies

Done when

  • JIT/AOT output_add_rewrite_var / output_reset_rewrite_vars invoke ResponseContext via PHP (thin ABI only)
  • RewriteVarsRuntime.php deleted or ≤ link stub
  • Compliance: test/compliance/cases/stdlib/output_rewrite_var*.phpt (VM + JIT variants) green
  • PR body cites php-src paths + LLVM lines removed

Related

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:compilerCompiler / CFG / JITarea:webWeb / CGI / superglobalsenhancementNew feature or requestimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimphase-0:FoundationPhase 0 – foundation & DevExphase-4:stdlibPhase 4 – stdlib for web appsstdlib

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions