pub struct HeapHeader {
pub kind: u16,
pub elem_type: u8,
pub flags: u8,
pub len: u32,
pub cap: u32,
pub aux: u64,
/* private fields */
}Expand description
Fixed-layout header for heap-allocated objects.
This struct is designed to be readable by JIT-generated code at known offsets.
The JIT can load kind at offset 0, len at offset 4, and aux at offset 16
without any Rust ABI knowledge.
Fields§
§kind: u16Object type discriminator (matches HeapKind and HEAP_KIND_* constants).
elem_type: u8Element type hint for homogeneous containers (0 = untyped/mixed). For arrays: 1=f64, 2=i64, 3=string, 4=bool, 5=typed_object. For typed objects: unused (0).
flags: u8Bitfield flags (FLAG_MARKED, FLAG_PINNED, FLAG_READONLY).
len: u32Element count (array length, field count, string byte length, etc.).
cap: u32Allocated capacity (for growable containers). 0 if not applicable.
aux: u64Auxiliary data interpreted per-kind:
- TypedObject: schema_id (u64)
- Closure: function_id (low u16) | captures_count (next u16)
- TypedTable/RowView/ColumnRef/IndexedTable: schema_id (u64)
- Future: future_id (u64)
- Enum: variant_id (low u32)
- Other: 0
Implementations§
Source§impl HeapHeader
impl HeapHeader
Sourcepub const OFFSET_KIND: usize = 0
pub const OFFSET_KIND: usize = 0
Byte offset of the kind field from the start of the header.
Sourcepub const OFFSET_ELEM_TYPE: usize = 2
pub const OFFSET_ELEM_TYPE: usize = 2
Byte offset of the elem_type field.
Sourcepub const OFFSET_FLAGS: usize = 3
pub const OFFSET_FLAGS: usize = 3
Byte offset of the flags field.
Sourcepub const OFFSET_LEN: usize = 4
pub const OFFSET_LEN: usize = 4
Byte offset of the len field.
Sourcepub const OFFSET_CAP: usize = 8
pub const OFFSET_CAP: usize = 8
Byte offset of the cap field.
Sourcepub const OFFSET_AUX: usize = 16
pub const OFFSET_AUX: usize = 16
Byte offset of the aux field.
Sourcepub fn new(kind: HeapKind) -> Self
pub fn new(kind: HeapKind) -> Self
Create a new HeapHeader with the given kind. All other fields are zeroed.
Sourcepub fn with_len_aux(kind: HeapKind, len: u32, aux: u64) -> Self
pub fn with_len_aux(kind: HeapKind, len: u32, aux: u64) -> Self
Create a HeapHeader with kind, length, and auxiliary data.
Sourcepub fn from_heap_value(value: &HeapValue) -> Self
pub fn from_heap_value(value: &HeapValue) -> Self
Build a HeapHeader from an existing HeapValue.
Extracts kind, length, and auxiliary data from the HeapValue’s contents.
Sourcepub fn clear_flag(&mut self, flag: u8)
pub fn clear_flag(&mut self, flag: u8)
Clear a flag.
Trait Implementations§
Source§impl Clone for HeapHeader
impl Clone for HeapHeader
Source§fn clone(&self) -> HeapHeader
fn clone(&self) -> HeapHeader
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more