Skip to content

GC relocation: inventory movable pointers and define the rewrite contract #333

Description

@chrisbbreuer

Parent: #144
Roadmap: #134
Related: #325

Define the auditable pointer and identity contract required before any heap cell can move. This is a correctness foundation, not a claim that compaction is active.

Scope

  • Inventory every heap-cell pointer representation and owner: NaN-boxed Values, raw typed pointers, atomic slots, native-private data, Wasm references, weak/finalization records, C/Objective-C/private-ABI handles, debugger state, interpreter frames, and JIT metadata.
  • Classify each occurrence as immovable, stable-handle-backed, precisely rewritable, interior, or forbidden across a safepoint.
  • Define a relocation visitor API distinct from marking, including strong, weak, ephemeron, atomic, optional, and interior-reference operations.
  • Define stable object identity across relocation and the forwarding metadata/header lifecycle.
  • Add a checked-in machine-readable inventory plus a verifier that fails on drift in declared pointer-bearing fields and root registries.
  • Document safepoint and native embedding rules without enabling movement yet.

Acceptance

  • Every production GC cell kind and root registry appears in the inventory with an explicit rewrite strategy.
  • The relocation visitor can express all current tracing edges without silently treating raw pointers as stable.
  • Forwarding metadata and stable identity rules are represented in code and covered by focused tests.
  • C API, Objective-C, Bun/Home ABI, inspector, Worker/Thread, Promise/module, Wasm, and JIT boundaries have explicit dispositions.
  • Inventory/verifier, focused normal tests, and focused TSan tests pass with zero leaks.
  • GC: implement moving and compacting collection #144 is updated with the committed evidence and the next child is unblocked.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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