ReviewOS

zig-utils/zig-gc

Heap: retain young survivors across multiple minor collections

#37
Closed chris opened this 9 days ago ·
9 days ago

Context

The current nursery is one-cycle: every live young cell is immediately tenured. zig-js #145 needs measurable multi-age survival before it can tune promotion policy or admit parallel mid-script minor collection.

Scope

  • Add a configurable, bounded tenuring age while preserving the young-prefix invariant.
  • Age live young cells across minor collections and promote only at the configured threshold.
  • Keep old-to-young owner cards and conservative target cards sound across repeated minors.
  • Adapt nursery sizing from all live young survivors, not only newly promoted bytes.
  • Publish exact young, survivor, promotion, and policy telemetry.
  • Keep full collection and nursery disable as explicit tenure boundaries.

Acceptance

  • Deterministic tests prove survival through multiple minors, threshold promotion, dead-young reclamation, persistent strong/weak cards, full-collection reset, and accounting.
  • Existing one-cycle behavior remains the default until an embedder selects a higher age.
  • Normal library tests and zig-js focused generational tests pass.

Downstream: zig-utils/zig-js#145

9 days ago

Collector implementation is on main in 1ccf87d. Headers now carry bounded survivor ages; configurable tenuring defaults to one cycle; minor sweep retains sub-threshold survivors; full collection and nursery disable tenure the frontier; old-owner cards persist; conservative target cards are compacted before sweep; adaptive sizing uses all surviving young bytes; accounting publishes exact young, promoted, survivor, reclamation, and policy values. Deterministic strong/weak/promotion/reset tests pass in Debug, ReleaseSafe, and suppression-free TSan. Keeping this open only for downstream zig-js #363 integration evidence.

9 days ago

The multi-age nursery/card-table core landed on zig-gc main in 1ccf87d; Debug, ReleaseSafe, and TSan passed locally and GitHub Actions run 29717143545 is green. Downstream zig-js integration is now on main in 06e334d2 / bdad267a / d1acf185, with focused three-age single-mutator and no-GIL evidence.

Sign in to comment on this issue.