-
-
Notifications
You must be signed in to change notification settings - Fork 159
fix(gc): close computed access rooting windows #8013
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
proggeramlug
merged 2 commits into
PerryTS:main
from
proggeramlug:fix/7640-rooting-windows
Aug 13, 2026
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| **Fixed: remaining computed reads and writes could reuse GC-stale receivers, keys, and backing pointers (#7640).** | ||
|
|
||
| Several typed-array, numeric-array, and generic computed-access paths evaluated | ||
| a receiver, then evaluated a key or value that could run user code and trigger | ||
| a moving collection, and finally consumed the receiver from its original LLVM | ||
| register. The same audit found typed-array stores deriving raw backing pointers | ||
| before an allocating RHS, and the array-growth path issuing its write barrier | ||
| against the pre-growth handle even when the helper returned a replacement. | ||
|
|
||
| The remaining read/write operands now use selective rooting and are re-read | ||
| after collecting expressions. Masked-window and `Ptr<NumArray>` native paths | ||
| use the custom-lowering form of the same scope; raw backing pointers are loaded | ||
| only after the RHS; and reallocating array stores shade through the returned | ||
| live head. Literal keys, loop counters, and other proven non-collecting windows | ||
| still emit no temporary-root traffic. | ||
|
|
||
| Class-field stores now distinguish their two receiver shapes explicitly. Bare | ||
| locals and `this` retain the existing zero-cost `root_reload` repair, while a | ||
| compound receiver such as `this.target.x` is conditionally rooted across an | ||
| allocating RHS because its phi result cannot be re-derived from a local root. | ||
|
|
||
| IR regressions assert the typed-array read/write groups, the erased-receiver | ||
| store, and the realloc-path barrier operand. Both end-to-end fixtures remain | ||
| byte-identical with Node 26.5.1. The 143-source shadow and native/statepoint GC | ||
| corpora report zero dominance, unrooted-allocation, or statepoint hazards and | ||
| catch all 40 seeded violations in each lowering. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift
Assert the protected operands in the emitted IR.
These assertions compare total root-slot counts.
Expr::Objectcan add slots for its own lowering. The tests can pass while the receiver or key is not stored before, then reloaded after, the collecting operand.Assert the parameter-specific root store and post-expression reload used by each dynamic helper. Keep the inert fixture assertion to verify the zero-root path.
crates/perry-codegen/src/expr/computed_store_rooting_tests.rs#L264-L267: assert that the typed-array receiver is rooted before key lowering and reloaded for@js_typed_array_index_get_dynamic.crates/perry-codegen/src/expr/computed_store_rooting_tests.rs#L295-L298: assert that the typed-array receiver and key are rooted before RHS lowering and reloaded for@js_typed_array_index_set_dynamic.crates/perry-codegen/src/expr/computed_store_rooting_tests.rs#L324-L328: assert that both erased operands are rooted before RHS lowering and reloaded for@js_dyn_index_set.As per coding guidelines, “A GC-managed value's root store must dominate every subsequent site that can collect.”
📍 Affects 1 file
crates/perry-codegen/src/expr/computed_store_rooting_tests.rs#L264-L267(this comment)crates/perry-codegen/src/expr/computed_store_rooting_tests.rs#L295-L298crates/perry-codegen/src/expr/computed_store_rooting_tests.rs#L324-L328🤖 Prompt for AI Agents
Source: Coding guidelines