Expand description
Unified heap object header (v2 runtime spec).
HeapHeader is a #[repr(C)] 8-byte struct that prefixes every heap-allocated
object, giving the JIT a stable memory layout to read kind/flags and perform
atomic reference counting without depending on Rust’s enum discriminant layout.
§Memory layout (8 bytes)
Offset Size Field
------ ---- -----
0 4 refcount (AtomicU32)
4 2 kind (HeapKind as u16)
6 1 flags (bitfield: MARKED, PINNED, READONLY, etc.)
7 1 _pad (reserved, always 0)Data starts at offset 8 (DATA_OFFSET).
Clone = atomic_fetch_add([ptr+0], 1, Relaxed).
Drop = atomic_fetch_sub([ptr+0], 1, Release).
Structs§
- Heap
Header - Fixed-layout header for heap-allocated objects (v2 runtime spec).
Constants§
- DATA_
OFFSET - Byte offset from the start of a heap allocation where payload data begins (immediately after the 8-byte HeapHeader).
- FLAG_
MARKED - Flag: object has been marked by the GC during a collection cycle.
- FLAG_
PINNED - Flag: object is pinned and must not be relocated by the GC.
- FLAG_
READONLY - Flag: object is read-only (immutable after construction).