Repository navigation
bootstrap-aot-link: VALUE-box concat + ordered float compare lowering - #8555
Conversation
|
claim: worker-lane-c — continuing open PR #8555 to green bootstrap-aot-link gate (Lane C issue; 11 failures remaining per PR body) |
|
Lane C continuation (PR #8563): structural fixes landed but gate still 13 failures — not merging. This commit:
Repro blockers (runtime segfault exit 139):
Verification: ./script/docker-exec.sh -- bash -lc 'make bootstrap-aot-link' # 13 failuresNext: fix ternary union string assign before return coerce; ensure getenv strict-false uses TYPE_VALUE through compare (CFG infers string). |
e5a4f85 to
0add056
Compare
Update (lane B run)Rebased onto current Verification ./script/docker-exec.sh -- bash -lc './vendor/bin/phpunit --filter testIsSkippedSelfHostEntryNameScopesCompilerTypePairOnly test/unit/JitCompilerSelfHostStubTest.php'
# OK (1 test, 3 assertions)
./script/docker-exec.sh -- bash -lc 'PHP_COMPILER_BOOTSTRAP_AOT_LINK=1 PHP_COMPILER_SELFHOST_AOT=1 PHP_COMPILER_M3_COMPILE_DRIVER=1 php bin/compile.php -o /tmp/vbs test/bootstrap-aot/value_bitwise_shift.php && /tmp/vbs'
# 65556 (was 19)
./script/docker-exec.sh -- bash -lc 'make bootstrap-aot-link'
# 11 failures (value_bitwise_shift now green; foreach_by_ref still 123 vs 246, ns_func empty, hash/crypto mismatches, several compile fails)Lane B had no eligible non-stdlib open issue ( |
Route TYPE_CONCAT into __value__ slots instead of native string concat, and lower boxed __value__ vs native double relational compares so deferred stdlib smoke and string concat AOT targets compile again (21→13 gate failures). Co-authored-by: Cursor <cursoragent@cursor.com>
Load script-global VALUE arrays via valuePtrFromVariable before readHashtable (foreach_by_ref), guard string dimAssign to real char lvalues, and rebind && short-circuit false-branch phi slots that were mis-typed from string offset fetches (ns_func compile). Co-authored-by: Cursor <cursoragent@cursor.com>
When logical-and if conditions compare a string offset (e.g. $path[1] === ':'), the CFG reuses the dim-fetch operand for the bool === result; box the bool into __value__ instead of throwing assign type mismatch (ns_func AOT compile). Co-authored-by: Cursor <cursoragent@cursor.com>
Scope isSkippedSelfHostEntryName to PHPCompiler\JIT\type_pair and PHPCompiler\VM\type_pair only so bootstrap-aot fixtures like value_bitwise_shift.php compile with real lowering. Co-authored-by: Cursor <cursoragent@cursor.com>
Remove broken Helper fast paths for VALUE===bool (used wrong pointers). Branch identicalToNative bool/long checks so LLVM select does not eagerly call __value__readLong on non-matching tags. Add JitValueBox::readStringOrNull for ?string ternary returns; copy getenv __value__* rvalues into stack slots on first bind. Gate still 13 failures — getenv===false and ternary string return segfault at runtime (repro: test/repro/getenv_identical_false.php). Co-authored-by: Cursor <cursoragent@cursor.com>
Patch php-types getenv to string|false so CFG inference uses VALUE-box IDENTICAL lowering; reorder Helper IDENTICAL before JitLongArg; narrow type_pair self-host stub skip; use __value__readString for nullable string returns; split valueSlot/valueRef in VALUE dest assigns. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Lane C run update (PR #8563, commit 1a719cb): Fixed / verified (AOT):
Still blocked:
Next step: fix ?: return-phi VALUE-box init / |
|
claim: worker-lane-b — continuing bootstrap-aot-link PR #8555 (Lane B had no eligible issue % 3 == 1) |
Route VALUE===native-bool strict compares before JitLongArg::lower to avoid __value__readLong on bool-tagged getenv results (#8555). For nullable scalar returns (__value__*), copy merge/ternary VALUE slots at return and box ?: merge operands when the function return type is nullable. Gate: 11 failures (was 12+); m3_getenv_smoke and value_bitwise_shift green. Co-authored-by: Cursor <cursoragent@cursor.com>
0add056 to
19e6104
Compare
Lane B update — PR #8555 pushed (not merged)Gate: `make bootstrap-aot-link` → 11 failures (down from 21 master / 12 prior commit). New in this push:
Still red: `ns_func.php` / `?: string|null` with `?string` return (AOT segfault), `m3_prelude_smoke` (segfault after getenv guard), hash/crypto compile mismatches, foreach_by_ref, several compile-fail smokes. Next: fix `?:` null-arm return for nullable scalars (LLVM merge slot / `__value__readString` on unified box); re-run gate. |
|
claim: worker-lane-b — continuing bootstrap-aot-link PR #8555 (Lane B issue % 3 == 1) |
Track function scope slots via jitCurrentBlock (not only entry block) so branch assigns and merge RETURN share one VALUE box. Skip freeing unnamed return phi temps marked dead by php-cfg, and resolve RETURN operands through functionScopeSlotBindings. AOT ?string ternary return still segfaults — next step is dominator-safe entry alloca or CoalesceHelper-style merge for string|null phi (#8555). Co-authored-by: Cursor <cursoragent@cursor.com>
|
Continued (Lane C) — handoff Root cause (AOT
|
Emit LLVM return from each ternary arm instead of merging into a shared slot that AOT mishandles for ?string (#8555). bootstrap-aot-link 21→10. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Merged via PR #8555 — nullable Verification: |
Stabilize ?: phi scope bindings across CFG blocks, compile non-string arms before string arms for shared RETURN merges, and add readOwnedStringOrNull for nullable returns. AOT still segfaults when the string arm is php-cfg block1 (if-entry); VM/JIT pass. Adds repro scripts and debug-phi-root probe. Co-authored-by: Cursor <cursoragent@cursor.com>
WIP handoff (lane C, PR #8563, commit c7d841a)Root cause narrowed (AOT-only)
CFG: both arms assign to the same phi slot (e.g. slot 3); What landed in c7d841a
Still failing repro./script/docker-exec.sh -- bash -lc 'php bin/compile.php -o /tmp/t test/repro/ns_nullable_ternary_return.php && /tmp/t' # exit 139
./script/docker-exec.sh -- bash -lc 'php bin/compile.php -o /tmp/t test/repro/aot_ternary_bool.php && /tmp/t' # exit 139
./script/docker-exec.sh -- bash -lc 'php bin/compile.php -o /tmp/ns test/bootstrap-aot/ns_func.php && /tmp/ns' # exit 139Suggested next stepCompare LLVM IR / native disassembly for string assign on if-entry BB vs identical assign on else-entry BB (same phi slot). Hypothesis: AOT codegen or alias bug specific to the if-entry LLVM block, not merge compile order per se (deferred merge + per-arm RETURN + branch inversion were tried without fixing if-arm string). PR #8563 updated; not merge-ready until bootstrap-aot-link repro is green. |
|
claim: worker-lane-c — continued PR #8563; fixed AOT segfault on |
Return typed string operands directly from the if-entry arm instead of reading the shared phi VALUE box after merge-block dead-operand frees. Nullable/union if-arms keep per-arm RETURN from the phi slot; pure string params skip the box on the string arm only. Verification: - test/repro/ns_nullable_ternary_return.php AOT exit 0 (was segfault) - test/repro/aot_ternary_bool.php AOT exit 0 - test/repro/getenv_identical_false.php AOT prints yes - make bootstrap-aot-link still 16 failures (ns_func, ne_null, …) Co-authored-by: Cursor <cursoragent@cursor.com>
|
claim: worker-lane-c-automation — continuing open PR #8563 to green remaining bootstrap-aot-link failures (aot_ternary_ne_null, ns_func, gate) |
Lane C continuation (not merge-ready)Continued PR #8563 — added boxed Verification./script/docker-exec.sh -- bash -lc 'php vendor/bin/phpunit --filter TernaryReturnMergeSlotTest'
# OK (2 tests)
./script/docker-exec.sh -- bash -lc 'PHP_COMPILER_BOOTSTRAP_AOT_LINK=1 php bin/compile.php -o /tmp/v test/repro/aot_ternary_var_nullable.php && /tmp/v'
# null / hello — exit 0
./script/docker-exec.sh -- bash -lc 'PHP_COMPILER_BOOTSTRAP_AOT_LINK=1 php bin/compile.php -o /tmp/nr test/repro/ns_nullable_ternary_return.php && /tmp/nr'
# exit 0
./script/docker-exec.sh -- bash -lc 'make bootstrap-aot-link 2>&1 | grep -c test/bootstrap-aot'
# 16 failures (unchanged)Still failing
Next
|
…hape When a ?: return merge has a boxed ?string on the if-entry arm, swap CFG arms and invert the branch condition so codegen matches the working null === $x ? null : $x shape (issue #8555). AOT standalone still segfaults on test/repro/aot_ternary_ne_null.php f('hello') (JIT/VM pass); ns_func blocked on return-inside-if after dim-fetch condition. bootstrap-aot-link still 16 failures — not merge-ready. Co-authored-by: Cursor <cursoragent@cursor.com>
…lpath. (#8576) LLVM miscompiled inlined libc stat(2)/realpath(3) in the same TU as getenv('PHP_COMPILER_M3_SOURCE') script-global setup; route is_file/file_exists mode probes and realpath() through standalone module helpers instead. Unblocks bootstrap-aot m3_prelude_smoke (#1492, #8555). Co-authored-by: PurHur <PurHur@users.noreply.github.com> Co-authored-by: Cursor <cursoragent@cursor.com>
…8563) (#8586) * Fix AOT ?: return for null !== $param ? $param : null pattern (#8563). Compile-time rewrite maps the if-entry ?string arm to null === $param ? null : $param (php-src equivalent) and tracks the JumpIf so branch targets stay aligned with IDENTICAL. Verification: php vendor/bin/phpunit test/unit/NullableNeNullTernaryRewriteTest.php test/unit/TernaryReturnMergeSlotTest.php php bin/vm.php test/repro/aot_ternary_ne_null.php PHP_COMPILER_BOOTSTRAP_AOT_LINK=1 php bin/compile.php -o /tmp/n test/repro/aot_ternary_ne_null.php && /tmp/n Co-authored-by: Cursor <cursoragent@cursor.com> * Fix AOT ?: return when non-null arm is if-entry (#8555) Return typed string operands directly from the if-entry arm instead of reading the shared phi VALUE box after merge-block dead-operand frees. Nullable/union if-arms keep per-arm RETURN from the phi slot; pure string params skip the box on the string arm only. Verification: - test/repro/ns_nullable_ternary_return.php AOT exit 0 (was segfault) - test/repro/aot_ternary_bool.php AOT exit 0 - test/repro/getenv_identical_false.php AOT prints yes - make bootstrap-aot-link still 16 failures (ns_func, ne_null, …) Co-authored-by: Cursor <cursoragent@cursor.com> * Fix AOT nullable ?string param returns via compile-time ?? rewrite (#8563). Rewrite direct and ternary returns of explicit ?T params to $param ?? null (php-src equivalent) so native AOT uses the proven coalesce VALUE-box path. Register nullable scalar returns as __value__* in JIT ABI; cherry-pick ?: merge lowering from #8555. Verification: php vendor/bin/phpunit test/unit/NullableNeNullTernaryRewriteTest.php test/unit/NullableStringReturnAbiTest.php PHP_COMPILER_BOOTSTRAP_AOT_LINK=1 php bin/compile.php -o /tmp/t test/repro/aot_ternary_ne_null.php && /tmp/t PHP_COMPILER_BOOTSTRAP_AOT_LINK=1 php bin/compile.php -o /tmp/t test/repro/aot_nullable_param_direct_return.php && /tmp/t Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: PurHur <PurHur@users.noreply.github.com> Co-authored-by: Cursor <cursoragent@cursor.com>
* Fix AOT ?: return for null !== $param ? $param : null pattern (#8563). Compile-time rewrite maps the if-entry ?string arm to null === $param ? null : $param (php-src equivalent) and tracks the JumpIf so branch targets stay aligned with IDENTICAL. Verification: php vendor/bin/phpunit test/unit/NullableNeNullTernaryRewriteTest.php test/unit/TernaryReturnMergeSlotTest.php php bin/vm.php test/repro/aot_ternary_ne_null.php PHP_COMPILER_BOOTSTRAP_AOT_LINK=1 php bin/compile.php -o /tmp/n test/repro/aot_ternary_ne_null.php && /tmp/n Co-authored-by: Cursor <cursoragent@cursor.com> * Fix AOT ?: return when non-null arm is if-entry (#8555) Return typed string operands directly from the if-entry arm instead of reading the shared phi VALUE box after merge-block dead-operand frees. Nullable/union if-arms keep per-arm RETURN from the phi slot; pure string params skip the box on the string arm only. Verification: - test/repro/ns_nullable_ternary_return.php AOT exit 0 (was segfault) - test/repro/aot_ternary_bool.php AOT exit 0 - test/repro/getenv_identical_false.php AOT prints yes - make bootstrap-aot-link still 16 failures (ns_func, ne_null, …) Co-authored-by: Cursor <cursoragent@cursor.com> * Fix AOT nullable ?string param returns via compile-time ?? rewrite (#8563). Rewrite direct and ternary returns of explicit ?T params to $param ?? null (php-src equivalent) so native AOT uses the proven coalesce VALUE-box path. Register nullable scalar returns as __value__* in JIT ABI; cherry-pick ?: merge lowering from #8555. Verification: php vendor/bin/phpunit test/unit/NullableNeNullTernaryRewriteTest.php test/unit/NullableStringReturnAbiTest.php PHP_COMPILER_BOOTSTRAP_AOT_LINK=1 php bin/compile.php -o /tmp/t test/repro/aot_ternary_ne_null.php && /tmp/t PHP_COMPILER_BOOTSTRAP_AOT_LINK=1 php bin/compile.php -o /tmp/t test/repro/aot_nullable_param_direct_return.php && /tmp/t Co-authored-by: Cursor <cursoragent@cursor.com> * Extend inline expr call-arg bridging to new expressions (#8561). php-cfg also splits Expr_New results from FuncCall/New ctor args; route TYPE_ARG_SEND through the producer slot directly to avoid AOT assign type mismatches. Unblocks const_string_folder bootstrap smokes. Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: PurHur <PurHur@users.noreply.github.com> Co-authored-by: Cursor <cursoragent@cursor.com>
…ges (#20266) (#20282) Add extractLongFromHelperResult (FGC-style) instead of global coerceHelperScalarResult readLong — bool boxes segfault (#8555) and previously broke vm-driver-probe. Thin standalone libc fork remains until NestedJIT emits phpc_*_kernel under always-helper. Co-authored-by: PurHur <PurHur@users.noreply.github.com> Co-authored-by: Cursor <cursoragent@cursor.com>
Summary
Lane B bootstrap-aot-link gate (#8555):
__value__temporaries writes via__value__writeStringinstead of nativeString_->concat().__value__and nativedoubleoperands for patterns likepi() > 3.0.IteratorHelper::asHashtableloads heap__value__*viavaluePtrFromVariablebefore__value__readHashtable.&&phi slots: skip stringdimAssignon non-char lvalues; rebind mis-typed phi operands when the short-circuit false branch assignsfalseafter a string dim fetch.isSkippedSelfHostEntryNameno longer stubs script-localtype_pair().TYPE_IDENTICALon VALUE vs native bool beforeJitLongArg::lower.?:return: direct LLVM return from each ternary arm (skip shared merge slot) fixes AOT segfault on?stringreturns;coerceReturnValuecopies__value__*merge slots when needed.Reduces
bootstrap-aot-linkfailures from 21 → 10 on this harness (master baseline: 21+).Closes #8555
Related: #1492 (bootstrap fallback)
Verification
Remaining gate failures (10)
compile_smoke_m3_emit_entry,foreach_by_ref,m3_prelude_smoke,stdlib_crc32c,stdlib_hashinclude_path_resolver_smoke,runtime_parse_compile_smoke,stdlib_array_ops,stdlib_filesystem,file_exists_concat