AOT: fix request_parse_body compile/link (#5965)#17316
Conversation
- Link __compiler_env_register_putenv via EnvLocalRuntime during standalone putenv JIT - Route GetenvJitHelper hashtable fills through phpc_native_ht_set_string_key (nested-JIT safe) - Promote list-unpack assign targets to entry allocas for LLVM dominance (#5965) - Preserve insert blocks across RequestParseBodyRuntime / EnvLocalRuntime nested emits Compile + link green for urlencoded/multipart fixtures; AOT runtime still segfaults at c:main_before_php (follow-up). Co-authored-by: Cursor <cursoragent@cursor.com>
|
Maintainer triage 2026-07-08: compile/link green per PR body but AOT runtime still segfaults at |
|
Maintainer triage 2026-07-08: compile/link green per PR body but runtime segfault remains — hold merge until AOT execute passes issue repro. |
- Link EnvLocalRuntime + RequestParseBodyRuntime in user-script standalone init - Route GetenvJitHelper fill/merge through phpc_native_ht_set_string_key (nested-JIT) - Split VM overlay merge into EnvLocalJitHelperVm (HashTable::update path) - Add issue repro scripts for putenv/request_parse_body AOT bisect Compile+link green; AOT execute still segfaults in __compiler_env_register_putenv. Co-authored-by: Cursor <cursoragent@cursor.com>
- BasicBlockHelper::restoreInsertBlock accepts null during standalone init - JitEnv::putenv calls GetenvJitHelper via JitNestedHelperCoerce (fixes AOT segfault) - RequestParseBodyEngine reads JIT+VM env overlay for CONTENT_TYPE/REQUEST_BODY - Defer RequestParseBodyRuntime from ensureMinimalUserStandaloneBodies (lazy link) - StringGetenv: preserve insert block across bridge emit AOT putenv-only repro green; request_parse_body execute still segfaults on nested helper call (empty parseIntoNative also crashes) — follow-up bisect needed. Co-authored-by: Cursor <cursoragent@cursor.com>
Continued work (2026-07-12, lane C)Pushed Fixed
Verification (Docker)PHP_COMPILER_CI_SINGLE_CONTAINER=0 ./script/docker-exec.sh -- bash -lc '
source script/php-env.sh && export PHP_COMPILER_PROFILE=8.4
php bin/vm.php test/repro/issue_5965_rpb_only.php
tmpdir=$(mktemp -d)
php bin/compile.php -o "$tmpdir/pe" test/repro/issue_5965_putenv_only.php && "$tmpdir/pe"
vendor/bin/phpunit test/unit/JIT/EnvLocalRuntimeStandaloneTest.php
'
Still red (blocker)
Not merge-ready until |
|
claim: cursor-agent-lane-a — continuing PR #17316 AOT request_parse_body execute fix |
- Route user-script AOT through RequestParseBodyNativeJitHelper (avoids nested-JIT of RequestParseBodyEngine which segfaults at main_after_init) - Call parseIntoNative via JitNestedHelperCoerce::callHelper from builtin lowering (mirrors putenv fix) instead of __compiler_request_parse_body bridge - Drop eager EnvLocalRuntime from ensureMinimalUserStandaloneBodies (putenv uses GetenvJitHelper overlay path) AOT putenv-only + VM repro green. request_parse_body() AOT execute still segfaults (139) before user output — bisect shows crash is not helper body logic (empty no-op helper also crashes). Next: hand-lowered LLVM path like ParseStrUserScriptDelimitedJit + MultipartRuntime for user-script AOT. Co-authored-by: Cursor <cursoragent@cursor.com>
Continued work (2026-07-13, lane A) — commit 9020369Progress
Bisect (AOT execute still red)PHP_COMPILER_CI_SINGLE_CONTAINER=0 ./script/docker-exec.sh -- bash -lc '
source script/php-env.sh && export PHP_COMPILER_PROFILE=8.4
tmpdir=$(mktemp -d)
php bin/compile.php -o "$tmpdir/pe" test/repro/issue_5965_rpb_only.php && "$tmpdir/pe"
'
# phpc: fatal signal (segfault) after c:main_before_php — exit 139
Crash occurs before user PHP output ( Next stepHand-lowered user-script LLVM like Not merge-ready until |
Summary
Continued #5965 — AOT standalone
putenv()compile+execute fixed;request_parse_body()AOT execute still blocked.Root fixes (commit 6fff073):
BasicBlockHelper::restoreInsertBlock(null)— standalone init no longer TypeErrors (Stdlib: request_parse_body() — PHP 8.4 HTTP body parser without superglobals (ext/standard/http.c) #5965)StringGetenv::implementpreserves insert block after bridge emit — fixes "Current basic block has no parent function" on AOT compileJitEnv::putenvroutes standalone throughGetenvJitHelper::putenvviaJitNestedHelperCoerce(avoids__compiler_env_register_putenvsegfault)RequestParseBodyEngine::overlayGetenvreads JIT putenv overlay + libc environ forCONTENT_TYPE/REQUEST_BODYRequestParseBodyRuntimefromensureMinimalUserStandaloneBodies(lazy link on first call)php-src ref:
ext/standard/http.c(request_parse_body),ext/standard/basic_functions.c(putenv/getenv)Verification (2026-07-12, Docker)
Blockers (next run)
request_parse_body()segfaults before user output; VM green. Bisect JITcall()return / nestedRequestParseBodyJitHelperlink.putenvdoes not populate overlay visible to__compiler_getenv; need unified helper path for both or fix register bridge without segfault.Closes #5965 when AOT fixtures
request_parse_body_{urlencoded,multipart}.phpt+putenv.phptexecute green.