ReviewOS

zig-utils/zig-js

GC relocation: rewrite realm, interpreter, module, job, and timer roots

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

Parent: #335 Depends on: #345 Roadmap: #144, #134

Implement the first complete root-registry relocation slice now that all cell edges can rewrite.

Acceptance:

  • Rewrite Context global/intrinsic/cache roots, module graphs, timers, microtasks/nextTicks, rejection/finalization queues, and completion/exception roots.
  • Rewrite active interpreter operand stacks, frames, environments, temporary/reserve roots, literals/templates, active call/debug frames, with stack, import.meta, and Wasm execution roots.
  • Rewrite roots only at the world-stopped commit boundary with no mutator-owned lock acquisition.
  • Preserve arena/native container addresses and queue ordering.
  • Distinct-target focused normal/TSan tests pass with zero leaks.
  • Production movement remains disabled and #335 is updated.
9 days ago

Completed the outer Context-root relocation slice in 72068ee1 (pushed to main).

Coverage now mirrors Binding.traceRoots across realm globals/builtins and the embedded global Environment; microtask/nextTick, rejection, timer, finalization, and async-wait queues; module caches; stable C-API boxes and class-prototype owners; private strong/weak handles; Thread results and join promises; GIL task jobs; property waitAsync tickets; active interpreters; and the host exception slot. Native/container/handle addresses remain stable while only managed payloads are rewritten after weak pruning at a world-stopped safepoint.

Focused evidence (one batched pass):

  • zig build test -Dtest-filter="realm root relocation": 6/6 passed, 0 leaked
  • same filter with -Dtsan: 6/6 passed, 0 leaked
  • zig build gc-relocation-inventory-check: 9 cell kinds, 26 pointer surfaces, 21 boundary tags; movement disabled

Together with 7012d7a4, the planned #349 interpreter/module/job/timer/Context root inventory is implemented. I am keeping this issue open until a descendant full GitHub Actions matrix validates the combined mainline.

9 days ago

Completed and accepted. The implementation-specific local evidence is recorded above, and descendant full CI at https://github.com/zig-utils/zig-js/actions/runs/29716788619 completed with 42 successful jobs, one intentional nightly skip, zero failures, and zero cancellations.

Sign in to comment on this issue.