Expand description
8-byte heap header for all v2 heap-allocated objects.
§Memory layout (8 bytes)
Offset Size Field
------ ---- -----
0 4 refcount (AtomicU32)
4 2 kind (u16 — GC/debug/serialization, never hot-path dispatch)
6 1 flags (bitfield)
7 1 _padRefcount is at offset 0 for fastest access — single-cycle load from base pointer.
Compiled code never reads kind; it knows the concrete type at compile time.
Structs§
- Heap
Header - 8-byte header for all v2 heap-allocated objects. Refcount at offset 0 for fastest access.
Constants§
- FLAG_
MARKED - FLAG_
PINNED - FLAG_
READONLY - HEAP_
KIND_ V2_ CLOSURE - Closure-spec Phase F: escape-fallback
TypedClosureHeaderallocation kind. AMakeClosureHeapopcode allocates aTypedClosureHeader-shaped block with this kind; Drop glue walks the closure’sheap_capture_maskand releases each pointer capture. Seedocs/v2-closure-specialization.md§1.3 and §5.3 for the full ABI. - HEAP_
KIND_ V2_ DECIMAL - R20 S2-prime-production: v2-raw
DecimalObjcarrier kind. The 24-byte#[repr(C)]struct (HeapHeader at offset 0 + inlinerust_decimal::Decimalat offset 8) lives indecimal_obj.rs. Per ADR-006 §2.7.24 Q25.A SUPERSEDED - HEAP_
KIND_ V2_ STRING - HEAP_
KIND_ V2_ STRUCT - HEAP_
KIND_ V2_ TRAIT_ OBJECT - Wave 2 Agent E (2026-05-14): v2-raw
TraitObjectStoragecarrier kind.TraitObjectStoragegrows aHeapHeaderat offset 0 (per ADR-006 §Q25.C.5 amendment and audit §4.3 Obstacle O-3.a resolution). The struct is#[repr(C)]; allocation goes throughTraitObjectStorage::_newwhich returns*mut TraitObjectStoragewith the header initialized viaHeapHeader::new(HEAP_KIND_V2_TRAIT_OBJECT). Refcount discipline on the raw-pointer path goes throughv2_retain/v2_releaseper theHeapElementtrait. TheNativeKind::Ptr(HeapKind::TraitObject)label is unchanged at the slot ABI. The struct continues to carry an innerArc<TypedObjectStorage>value half +Arc<VTable>vtable half during Wave 2 Round 2 transition; D2’s parallel close evaporates the innerArc<TypedObjectStorage>wrapping. Next free post-HEAP_KIND_V2_TYPED_OBJECT=86. - HEAP_
KIND_ V2_ TYPED_ ARRAY - HEAP_
KIND_ V2_ TYPED_ MAP - HEAP_
KIND_ V2_ TYPED_ OBJECT - Wave 2 Agent D1 (2026-05-14): v2-raw
TypedObjectStoragecarrier kind.TypedObjectStoragegrows aHeapHeaderat offset 0 (per ADR-006 §2.3 amendment and audit §4.3 Obstacle O-3.a resolution). The struct is#[repr(C)]; allocation goes throughTypedObjectStorage::_newwhich returns*mut TypedObjectStoragewith the header initialized viaHeapHeader::new(HEAP_KIND_V2_TYPED_OBJECT). Refcount discipline on the raw-pointer path goes throughv2_retain/v2_releaseper theHeapElementtrait. TheNativeKind::Ptr(HeapKind::TypedObject)label is unchanged at the slot ABI. Next free post-HEAP_KIND_V2_DECIMAL=85.