Parent: #62 Related: zig-utils/zig-gc#4, zig-utils/zig-gc#5
Problem
GC-enabled single-mutator execution enables zig-gc nursery collection, but the previous mid-script driver ignored the young-generation threshold and started full incremental marking from total live bytes. Allocation-heavy loops therefore retraced old built-ins and long-lived objects instead of reclaiming short-lived young cells through a minor cycle.
Implemented scope
- run a stop-the-world minor collection at a single-mutator JS safepoint when the nursery threshold is reached and no full/concurrent cycle is active;
- decide new full cycles from tenured bytes with shouldCollectOld;
- preserve native-stack and parked-stack root publication around the minor pause;
- retain parallel-mutator safety rules;
- use the 4 MiB zig-gc nursery policy from zig-utils/zig-gc#5;
- avoid repeated exact-ownership bucket scans and immutable promoted-function rescans.
Acceptance criteria
- A running JS loop triggers multiple minor collections before returning to a quiescent boundary.
- The same loop avoids full collections when tenured pressure is held below threshold.
- Exact results and retained young graphs survive minor collection.
- Existing incremental, concurrent, parallel, and full collection tests remain correct.
- The bounded object_churn checksum remains 1030552128 and direct throughput materially improves.
- Focused GC tests, zig-gc tests, benchmark harness tests, and the 751-test zig-js suite pass.
- Run the final TSan gate with the eventual publication batch.