Skip to content

GC: add failure-atomic relocation planning and commit hooks #35

Description

@chrisbbreuer

Downstream: zig-utils/zig-js#334\nDepends on downstream contract: zig-utils/zig-js#333\n\nAdd an opt-in, generic stop-the-world relocation mechanism without changing non-moving embedders.\n\n## Scope\n\n- Let a binding declare whether a marked cell kind is movable.\n- Reserve all same-size destinations before any old cell, root, edge, index, or publication metadata is mutated.\n- Roll back every unpublished destination on allocation failure with exact backing accounting.\n- Record old/new payloads, kind, size, and a stable logical ID for the complete plan.\n- Expose infallible strong/weak/atomic/interior resolver hooks to the binding for root and cell-edge rewriting.\n- Commit copied headers/payloads, indexes, owned-storage publication, and old-storage release in one world-stopped phase.\n- Preserve mark, age/generation, remembered-set, live-byte/cell, finalizer, and collection accounting.\n- Keep the default collector byte-for-byte non-moving when the binding omits relocation hooks.\n\n## Acceptance\n\n- [ ] Exact generic tests cover zero cells, mixed pinned/movable cells, all size classes, cycles, weak survivors/deaths, and stable identity.\n- [ ] Failure injection at every destination reservation proves the old graph, indexes, ownership, and accounting are unchanged.\n- [ ] Successful compaction releases evacuated storage without running live-cell finalizers.\n- [ ] Repeated normal, ReleaseSafe, and suppression-free TSan gates pass with zero leaks.\n- [ ] README/API documentation defines the binding contract and downstream zig-js consumes an exact commit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions