fix(codegen): use live receiver in stable packed loops - #9270
Conversation
dd2e5fb to
7125b99
Compare
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
Included review availability: Your plan provides up to 8 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughStable packed-loop admission now always uses ChangesStable packed loop receiver fix
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to This localized codegen fix prevents optimized packed loops from reading through a stale receiver after array growth while preserving the generic fallback for invalid admission. The affected regressions pass, and no actionable merge-blocking risk remains after normal checks and review. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Description checkExplanation The description follows the repository template and covers the summary, concrete changes, related issue, test results, screenshots/output, and checklist. It clearly identifies the release build and full workspace tests that were not run. Full details: Linked Issues checkExplanation The pull request satisfies issue Full details: Docstring CoverageExplanation Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 3 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Merged. The defect class is the one that costs the most to find later: a local naming an Array growth forwarding stub, then the fast clone reloading and de-tagging that stale local for direct reads. Consuming the live address the guard already computed is the right shape — the guard was doing the work and codegen was throwing the answer away. Probed the shapes that produce a stub rather than trusting the description:
All byte-identical to node 26.5.1, and identical again under Worth noting the cost this accepts: the non-captured arm now always calls Also re-ran the #9246 and #9250 array-store probes against this build; both still match node, so the tier changes and this one do not interact. Validation: |
|
Audited the diff (not the description) — this is a genuine root-cause fix and I'd merge it once The change removes the capture/ordinary-local branch so both paths call The two IR-contract edits are tightenings, not weakenings, which is the thing I check for: - system.contains("call i32 @js_packed_arraylike_loop_guard(")
+ system.contains("call i64 @js_packed_arraylike_loop_guard_live(")
One note for the record, since it may save someone else the detour: the PR summary says the fix is "already present on Verification caveat worth honouring: #9117 is optimization-state dependent — it passed on candidate |
Summary
Port the root fix already present on
release/v0.5.1519tomain. Stable packed loops now consume the live Array address returned by admission, preventing direct reads through a stale forwarding stub after cross-call growth.Changes
js_packed_arraylike_loop_guard_livefor ordinary-local as well as captured receivers.Related issue
Fixes #9117
Test plan
165171instead of499500.RUST_TEST_THREADS=1 cargo test -p perry --test issue_5139_object_arraylike_method_dispatch any_typed_real_arrays_keep_array_mutator_semantics -- --exact --nocapture(1/1)cargo test -p perry --test issue_8655_array_subclass_indexing(2/2)cargo test -p perry --test issue_8690_loop_versioned_arraylike(3/3)cargo test -p perry --test issue_8773_closure_capture_packed_loops(4/4)./scripts/pre-tag-check.sh --quickcargo build --releaseclean (not run; scoped release static-runtime build and tests above passed)Screenshots / output
Before:
grow: 1000 1000 165171After: the regression assertion passes with
grow: 1000 1000 499500.Checklist
fix:prefix convention used in the logSummary by CodeRabbit
Bug Fixes
Tests