Expand description
Fixed-layout heap object header for JIT-friendly type dispatch.
HeapHeader is a #[repr(C, align(16))] struct that prefixes heap-allocated
objects, giving the JIT a stable memory layout to read the object’s kind, length,
and capacity without depending on Rust’s enum discriminant layout.
§Memory layout (32 bytes, 16-byte aligned)
Offset Size Field
------ ---- -----
0 2 kind (HeapKind as u16)
2 1 elem_type (element type hint for arrays/typed objects)
3 1 flags (bitfield: MARKED, PINNED, READONLY, etc.)
4 4 len (element count / field count)
8 4 cap (allocated capacity, 0 if not applicable)
12 4 (padding)
16 8 aux (auxiliary data: schema_id, function_id, etc.)
24 8 (reserved / future use)Modules§
- elem_
types - Element type hints for the
elem_typefield.
Structs§
- Heap
Header - Fixed-layout header for heap-allocated objects.
Constants§
- 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).