ReviewOS

zig-utils/zig-gc

heap: keep stable cell identity in the 32-byte header

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

Downstream: zig-utils/zig-js#411 Regression source: #39 (c17c01af7ee8a38bbe1b47bc02751653d2b81afc)

Adding the process-stable u64 cell ID expanded Heap.Header from 32 to 48 bytes after 16-byte payload alignment. A 96-byte zig-js Object therefore moved from a 128-byte allocation to 144 bytes and into the 256-byte backing bucket on Linux/main CI.

Acceptance:

  • Preserve process-unique, non-recycled, relocation-stable cell IDs.
  • Narrow the checked payload size representation and pack marked/young/remembered state into one atomic byte without data races.
  • Restore @sizeOf(Header) == 32 and header_stride == 32 on supported 64-bit targets.
  • Cover independent flag transitions, batch allocation, minor/full collection, remembered sets, concurrent marking, relocation, and stable metadata.
  • Run focused Debug, ReleaseSafe, and TSan evidence and update the README if allocator documentation changes.
  • Reconcile exact main CI before closure.
9 days ago

Implemented and pushed in 09f1d51. The header is compile-time pinned to 32 bytes on 64-bit targets; cell payload size is checked/narrowed to u32; marked, young, remembered-owner, and remembered-target transitions share one atomic byte without clobbering sibling bits. Debug, ReleaseSafe, and local TSan all pass. Exact main CI: https://github.com/zig-utils/zig-gc/actions/runs/29791808593

9 days ago

Exact main CI is green at 09f1d51: both test and the 20-iteration Linux tsan job succeeded in https://github.com/zig-utils/zig-gc/actions/runs/29791808593. Closing.

Sign in to comment on this issue.