Skip to content

fix(gc): rearm closure young log after slot rewrites - #11118

Merged
proggeramlug merged 2 commits into
PerryTS:mainfrom
proggeramlug:fix/11117-closure-dynamic-props-young-log
Sep 23, 2026
Merged

proggeramlug merged 2 commits into
PerryTS:mainfrom
proggeramlug:fix/11117-closure-dynamic-props-young-log

Conversation

@proggeramlug

@proggeramlug proggeramlug commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #11117.

Closure dynamic properties and static prototypes are temporarily removed from their side tables while GC layout visitors rewrite their slots. If a visitor changed an old value to a nursery or survivor pointer, those paths republished the entry without re-arming CLOSURE_YOUNG_OWNERS. The next minor-scoped scan could therefore skip a live young pointer, and the debug completeness check reported the rule-1 assertion from the issue.

This change notes the owner before republishing rewritten dynamic properties or a rewritten static prototype. The normal setter already follows the same pre-publish rule.

Validation

  • Added focused tests for an old closure whose dynamic property or static prototype is rewritten to a young value.
  • A/B: removing the two new note calls makes both tests fail with young log for closure.dynamic_props does not name ...; restoring them makes both pass.
  • cargo test -p perry-runtime --lib gc::tests::young_log_tests:: — 29 passed.
  • Exact issue reproducer: RUST_TEST_THREADS=1 cargo test -p perry-stdlib --lib readline::mod_tests::listeners_provider_roots_readable_snapshot_across_array_allocation -- --exact --nocapture — passed.
  • cargo check -p perry-runtime --all-targets — passed.
  • cargo fmt --all -- --check — passed.
  • scripts/check_file_size.sh — passed.

Summary by CodeRabbit

  • Bug Fixes
    • Fixed an issue where minor garbage collection could miss newly young references in closure properties or prototypes after those values were rewritten. These references are now preserved through collection, preventing them from becoming stale while the owning closure remains in use.

@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: 69aa4ef6-feb2-4330-9347-f08d416141bb

📥 Commits

Reviewing files that changed from the base of the PR and between 9d26936 and e9421d0.

📒 Files selected for processing (3)
  • changelog.d/11118-closure-young-log-rewrite.md
  • crates/perry-runtime/src/closure/dynamic_props.rs
  • crates/perry-runtime/src/gc/tests/young_log_tests.rs

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


📝 Walkthrough

Walkthrough

Closure slot visits now note rewritten dynamic property values and static prototypes before re-inserting entries. New tests check that minor collections evacuate those rewritten values on old closures.

Changes

Closure slot visits

Layer / File(s) Summary
Re-arm young-log entries for rewritten slots
crates/perry-runtime/src/closure/dynamic_props.rs, crates/perry-runtime/src/gc/tests/young_log_tests.rs, changelog.d/11118-closure-young-log-rewrite.md
Dynamic property and static prototype visits note rewritten values before re-inserting entries. Tests verify that minor collections evacuate rewritten values on old closures. The changelog records the fix.

Priority: ⚪ Not assessed

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

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to e9421

The closure rewrite fix has no identified merge-blocking issue; complete the normal checks before merging.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning 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 6 functions across 2 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: rearming the closure young log after slot rewrites.
Description check ✅ Passed The description explains the bug, the fix, the related issue, and validation results. The Validation section provides the required test-plan information, and screenshots are not relevant to this runti…
Linked Issues check ✅ Passed The PR addresses issue #11117's missing young-log write barrier. In visit_closure_dynamic_prop_values_mut, it computes a minor-relevant rewritten value and calls note_young_closure_owner before re…
Out of Scope Changes check ✅ Passed The changed runtime code directly implements the closure young-log fix for #11117. The two regression tests verify the fix. The changelog records the same behavior. No unrelated change is shown in the…
Full details: Docstring Coverage

Explanation

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 6 functions across 2 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ 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
proggeramlug merged commit aa55791 into PerryTS:main Sep 23, 2026
67 of 69 checks passed
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.

GC young-log rule-1 assertion aborts perry-stdlib tests on clean main: a writer of closure.dynamic_props publishes without note()-ing the key

1 participant