Skip to content

php-in-php: prep ParseStrNative refresh path (toward #18855) - #18863

Merged
PurHur merged 1 commit into
masterfrom
agent/runtime-php-parse-str-delimited-v2
Jul 14, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/runtime-php-parse-str-delimited-v2

Conversation

@PurHur

@PurHur PurHur commented Jul 14, 2026

Copy link
Copy Markdown
Owner

Summary

Preparatory fixes toward deleting ParseStrUserScriptDelimitedJit.php and routing user-script superglobal refresh through ParseStrNativeJitHelper / __compiler_parse_str (#18855).

  • JitVmHelperLink: unset PHP_COMPILER_AOT_USER_SCRIPT during nested VM-helper JIT (mirrors preg path; fixes no-op stub helpers under user-script AOT init Fix AOT CGI superglobal refresh: QUERY_STRING populates $_GET (closes #18832) #18841).
  • StringParseStr: user-script standalone init calls ParseStrRuntime::ensureUserScriptLinked() instead of embed ensureLinked().
  • ParseStrRuntime: replace deferred stub bodies before re-emitting bridges; materialize dest via alloca + callHelper.

Not in this PR: ParseStrUserScriptDelimitedJit.php deletion — blocked on nested-helper ABI (below).

Blocker (full #18855)

Routing refresh through ParseStrNativeJitHelper::parseIntoNative (via __compiler_parse_str or direct LLVM call) leaves $_GET empty in real AOT binaries.

Disassembly shows LLVM bridges pass (i64* stack, __hashtable__*, __string__*) without emitting ptrtoint(ht); parseIntoNative entry keeps destPtr=0 and returns early. Master’s hand-LLVM __phpc_parse_str_parse_delimited_pairs path still required for green NestedSuperglobalsAotTest.

Next step: fix external LLVM → nested JIT int param ABI (emit ptrtoint in rdi, or load param 0 correctly at helper entry), then re-apply refresh routing + delete ~1020-line delimited JIT file.

Test plan

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit test/aot/NestedSuperglobalsAotTest.php test/unit/ParseStrRuntimeShrinkTest.php test/unit/JIT/SuperglobalsBracketRuntimeStandaloneTest.php'
make bootstrap-selfhost-vm-driver-execute-probe
OK (1 test, 5 assertions)  # NestedSuperglobalsAotTest
OK (15 tests, 72 assertions)  # shrink + bracket standalone
bootstrap-selfhost-vm-driver-execute-probe: OK

Made with Cursor

Unset user-script AOT env during nested VM-helper JIT, route StringParseStr
standalone init through ensureUserScriptLinked, and harden parse_str bridge
stub replacement plus callHelper dest materialization.

Full deletion of ParseStrUserScriptDelimitedJit remains blocked: LLVM bridges
into nested ParseStrNativeJitHelper omit ptrtoint so destPtr stays zero at
runtime (NestedSuperglobalsAotTest repro).

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.

1 participant