docs(gc): RFC — deferred collection (L2b) - #11528
proggeramlug wants to merge 2 commits into
Conversation
Design only, for owner review. Proposes that allocation never begins a precise collection, that precise collections begin only at declared polls, and that a call is a safepoint only if its callee may reach a poll, computed by a call-graph checker over the linked runtime archives. Includes the claude-code bundle relocation census, the memory-bound design, interactions, a six-step migration plan and open questions.
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks 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 |
Owner decisions on §8 (2026-09-27)
Proceeding: S0 = #11500, S1 = soundness fixes #11522/#11523 + the call-graph checker + the generated table (census tooling moves into |
…he deferred-collection RFC Adds the owner's 2026-09-27 decisions as section 8, resolving the ten open questions (OldReclaim stays at the allocation point, three-target checker, valve as a hard pr-gate failure, RSS bar, census ratchet). Adds the fast-path-split census (13.89M -> 3.23M relocations when stacked on L2b plus the throw cut) with its caveats. Reorders the migration plan to S0 #11500, S1 table and checker, S2 fast/slow IC splits (argued sound on today's runtime, helper by helper), S3 rematerialization, then the estimator, the runtime invariant, L2b and the throw cut.
Owner decision on the S2 static-reduction question (2026-09-27)Yes: add a step after S4. S2 (fast/slow IC splits) ships as a runtime win: the hot path is gc-leaf, and the slow call stays a statepoint. A new step S4b follows the liveness estimator: at each out-of-line slow call site, the live GC values are rooted in plain stack slots recorded in the GC map and updated in place by the collector. That means no |
S4 landed as a PR: the design changed in three placesS4 (the linear liveness estimator) is PR #11624. The RFC's S4 row says "backward liveness of root allocas across the classified safepoints of the pre-RS4GC IR, O(instructions + roots)". The implementation differs in three ways, each forced by measurement. I am recording them here rather than editing the RFC branch.
Two findings that bear on S4b and later steps:
|
S5 (runtime invariant + new polls): implementation notes and design changesS5 is split into two PRs: #11630 (runtime invariant, safety net, gates) and #11631 (entry polls, stacked on #11630). The design differs from §2 in the ways below.
Owner question (blocks S6, not S5): before |
Design only, for owner review. No code changes. Adds
docs/src/internals/rfc-deferred-collection.mdand links it fromSUMMARY.md. This is a docs-only PR, so no changelog fragment is needed (the fragment rule applies tocrates/changes).Proposal (lever L2b)
runtime_poll()inside garbage-heavy helpers;gc(); and the pump boundaries.Leaf,AllocOnly,ThrowOnly,Reenters. CI fails if a leaf-classified symbol reaches a JS-invoking symbol (the fix(gc):js_array_lengthis classified AllocNoReentry but its Proxy arm runs user JS (get trap + number coercion) #11522 class). A runtime unmapped-frame verifier, run together with the seeded schedule, is the second layer.Key finding
The nursery half of this already ships. What is new is making it an invariant: the OldReclaim alloc-point arm, budgeted root-scan and remark in mutator assists, and root-lock flushes (#11523) move to polls. Codegen then exploits the invariant.
Measured (claude-code bundle)
__25747under the RS4GC pipeline: 125 s → 41 s.Migration
S0 #11500 → S1 soundness fixes + checker + L2 table (sound today) → S2 linear liveness estimator → S3 runtime invariant + polls → S4 L2b → S5 throw cut → S6 fast/slow splits.
Deviation from the suggested order: the throw cut has to wait for S3. The throw helpers allocate, and today that allocation can reach a precise root scan at an unmapped frame.
Open questions
Ten, in §8 of the RFC. The main ones: