Skip to content

perf(runtime): skip unchanged spill layout notes - #11098

Closed
proggeramlug wants to merge 2 commits into
PerryTS:mainfrom
proggeramlug:perf/10872-named-spill-layout
Closed

proggeramlug wants to merge 2 commits into
PerryTS:mainfrom
proggeramlug:perf/10872-named-spill-layout

Conversation

@proggeramlug

@proggeramlug proggeramlug commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • route object spill-slot writes through the existing value-aware layout hook
  • skip the full GC layout update when an overwrite keeps the same pointer kind
  • preserve pointer-mask updates for scalar/pointer transitions and array element-shape bookkeeping for pointer overwrites
  • add a regression test that measures full layout-hook calls and verifies the spill pointer mask

Testing

  • RUST_TEST_THREADS=1 cargo test --profile perry-dev -p perry-runtime --lib -- --test-threads=1 (4,379 passed; 5 ignored)
  • cargo fmt --all -- --check
  • ./scripts/check_file_size.sh
  • python3 scripts/gc_runtime_root_holders.py
  • python3 scripts/check_test_registration.py

Fixes #10872

Summary by CodeRabbit

  • Performance
    • Repeated updates to object spill slots now avoid redundant garbage-collection layout bookkeeping when the value’s pointer kind remains unchanged. Changes between scalar and pointer values continue to update the layout tracking, preserving correct garbage-collection behavior.

@coderabbitai

coderabbitai Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: c5fae102-4654-4c99-a13d-e5847283e34c

📥 Commits

Reviewing files that changed from the base of the PR and between 7f4417b and 0b80204.

📒 Files selected for processing (5)
  • changelog.d/11098-spill-layout-notes.md
  • crates/perry-runtime/src/gc/layout.rs
  • crates/perry-runtime/src/object/mod.rs
  • crates/perry-runtime/src/object/spill.rs
  • scripts/gc_runtime_root_holders.json

Included review availability: Your plan provides up to 8 included reviews per hour; 2 remain after this review.


📝 Walkthrough

Walkthrough

Spill-slot writes now skip the full GC layout-note path when an overwrite keeps the same pointer kind. Writes that change the slot between scalar and pointer values still update the slot mask. Tests count layout-note calls and check pointer-slot counts.

Changes

Spill Slot Layout-Note Optimization

Layer / File(s) Summary
Update spill-store layout-note calls
crates/perry-runtime/src/object/spill.rs, crates/perry-runtime/src/gc/layout.rs, crates/perry-runtime/src/object/mod.rs, scripts/gc_runtime_root_holders.json, changelog.d/11098-spill-layout-notes.md
spill_store_slot uses the prior slot bits to skip the full layout note for same-kind overwrites. Test instrumentation and assertions cover scalar and pointer overwrites, kind transitions, and pointer-slot counts. The changelog records the behavior.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Refactor

Merge Risk: ⚪ Minimal · up to 0b802

The spill-store optimization has no identified issue that needs resolution before merge.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: skipping unchanged spill layout notes for runtime performance.
Description check ✅ Passed The description explains the optimization, preserves the required transition behavior, identifies the regression test, links issue #10872, and lists verification commands. It omits the template's sepa…
Linked Issues check ✅ Passed The PR addresses the coding objective in issue [#10872]. spill_store_slot reads the previous slot value and calls layout_note_slot_aware instead of always calling layout_note_slot. Same-kind sca…
Out of Scope Changes check ✅ Passed The changes stay within issue [#10872]. The test-only call counter, test exports, root-holder entry, layout documentation update, regression tests, and changelog entry support verification or document…
Docstring Coverage ✅ Passed Docstring coverage is 80.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 3 files. (2 skipped: 2 u…
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@proggeramlug

Copy link
Copy Markdown
Contributor Author

Landed on main in merge train 266 (#11109), released as v0.5.1649 at 784ed8e2c4.

Cherry-picked from this PR's head 0b80204f09 and validated as one tree — CI 22/22 green, all 6 gap-suite shards. A train rebase gives the commits new SHAs, so GitHub cannot auto-close the source PR; closing by hand.

Nothing needed from you. Thanks.

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

Labels

None yet

Projects

None yet

1 participant