ReviewOS

zig-utils/zig-js

GC relocation: allow quiescent compaction with the pointer-free baseline JIT

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

Parent: #336 Related: #133, #146, #350, #351, #357

The explicit moving-GC boundary currently rejects every context whose baseline JIT is enabled, even when the realm is fully quiescent. That is stricter than the current native tier requires: generated code embeds no movable GC pointers, compiled code and tier metadata are arena/native-owned, numeric scratch is pointer-free, and a live NativeFrame can exist only under an active interpreter—which compaction already rejects.

Scope:

  • remove the blanket JIT-enabled rejection from Context.compactGarbage while retaining the active-interpreter, running-thread, conservative-stack, concurrent collector, and relocation-token gates;
  • machine-check the narrower fail-closed contract in the relocation inventory;
  • add a supported-architecture regression that compiles and executes a genuine numeric baseline tier, moves the rooted function/object graph at a quiescent point, and proves the same native tier executes correctly afterward;
  • update the Zig, C, Objective-C, relocation, JIT, API, and concise README documentation;
  • keep movement during active native execution unsupported until precise stack maps / a complete stop-the-world rewrite protocol exist.

Acceptance:

  • quiescent compaction in a JIT-enabled precise-GC context returns compacted or no_candidates rather than unsupported;
  • a ready native tier remains ready and is entered after relocation;
  • all existing active-interpreter and conservative/native-stack rejection witnesses remain green;
  • Debug, ReleaseSafe, and TSan focused evidence is leak-free.
9 days ago

Implemented and pushed in cc0837d. Quiescent precise-GC contexts no longer reject the current pointer-free baseline JIT merely because it is enabled. The active-interpreter/native-frame, conservative-stack, running-thread, collector, and relocation-token gates remain fail-closed. The new AArch64 witness compiles a numeric tier, relocates its Function/Object graph, proves the arena chunk and immutable native entry remain stable, and re-enters that same tier afterward. The C and Objective-C hosts now exercise JIT-enabled precise-GC contexts. Debug, ReleaseSafe, and TSan compaction batches each passed 6/6 with zero leaks; C/Objective-C hosts, 117/117 C audit plus extensions/private exports, 108/108 Objective-C audit, and the 9-kind/27-surface inventory are green.

Sign in to comment on this issue.