perf(codegen): inline births are black and seeded; omit redundant root-store shading (#11929) - #12059
Merged
Merged
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configuration
⛔ Files ignored due to path filters (4)
📒 Files selected for processing (34)
✨ 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 |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #11929. Re-lands #12037 (reverted by #12038) with the inline-birth hole closed structurally.
What
Codegen no longer emits incremental-mark shading on stores into GENERATED GC roots: compiler-managed locals, temporary roots, module globals, persistent scalar/array root aliases. Root bindings/registrations, heap/runtime barriers (closure captures stay heap slots with
js_write_barrier_slot) and all GC gates are unchanged.Removing root-store shading is sound because of two things TOGETHER:
bound_ptr()).Neither alone suffices.
Inline births (the hole that caused the revert)
Both inline codegen allocators,
newand small array literals/bundles, now go through ONE shared mechanism that mirrors the runtime allocator:js_gc_note_black_birth, which rechecks MARKED and pointer-free itself);There is no safepoint inside that window. The array literal's re-entering numeric-layout normalizer runs after it, with the array rooted. During a budgeted sweep the flags are 0, so there is no MARKED bit and no seed, exactly as in the runtime allocators. Those births fall past the sweep snapshot's recorded fill (#11842).
There is no exact
gc_flags == GC_FLAG_ARENAprecheck in the source or the emitted IR, so black births don't fall to the slow path.The audit covers every allocation path:
Results (qb6, 5 interleaved runs, medians; main → head)
Root-shading calls: generic witness 26 → 0, q200 2,608 → 0.
Verification
newand array literals, and seed-before-init under a forced step, all fail as intended.PERRY_GC_BUDGETED_OLD_RECLAIM=1+PERRY_GC_PROTECT_OLD_SWEEP=1(quarantine banner confirmed).Reviewed by the GC owner before opening: seed ordering for
newacross the constructor, the array-literal ordering, sweep-phase flags = 0, and seed lifetime across DisableBarrier → sweep snapshot.