Parent: #62 Dependency: zig-utils/zig-gc#7 Related: #63
Problem
Mid-script nursery collection conservatively scans the native stack. zig-gc currently rebuilds and sorts an address extent for every live cell once per collection and binary-searches it for every stack word, even though GcCellBacking already maintains sorted chunk address indexes for every owned size class.
In the post-#65 object_churn sample, the generic sort is 98 top-of-stack samples and conservative lookup is 73, making root classification one of the largest remaining collection costs.
Scope
- classify arbitrary addresses against the existing per-size-class chunk indexes;
- map issued owned slots back to their exact allocation base while distinguishing outside/unissued storage;
- compile-time prove every current
CellKindallocation fits owned slab storage before claiming the generic fallback is unnecessary; - preserve exact payload-extent/header-magic validation in zig-gc;
- retain thread-safe classification in parallel/concurrent modes;
- compare the exact bounded
object_churnchecksum and profile before/after.
Acceptance criteria
- Current cell taxonomy is exhaustively covered by a compile-time owned-size proof.
- Live exact/interior stack roots survive minor/full collection.
- Header, padding, freed, unissued, and foreign addresses reject safely.
- The generic per-collection sort disappears from the downstream profile.
- Exact checksum remains 1030552128 and throughput materially improves.
- Focused dependency/downstream tests and final batched suites pass.