pub struct SlotStackHeader<T: Copy> { /* private fields */ }Expand description
The three-word header generated code bump-allocates against.
#[repr(C)] and pointer-shaped rather than index-shaped: the prologue’s
whole job is top → zero → top + n*8, and holding raw addresses makes
that three instructions with no base-plus-scaled-index arithmetic.
The fields stay private and the backend reaches top through
Self::TOP_OFFSET. That is strictly better than making the field pub so
the backend can offset_of! it: the displacement is still derived from the
#[repr(C)] layout at compile time, but no other crate can write the field.
Generic in the slot type because the mechanism is not specific to GC roots;
see SlotStack.
Implementations§
Source§impl<T: Copy> SlotStackHeader<T>
impl<T: Copy> SlotStackHeader<T>
Sourcepub const TOP_OFFSET: i32
pub const TOP_OFFSET: i32
The byte offset of top within the header, for the backend to emit as a
load/store displacement. Computed from the #[repr(C)] layout so it
stays correct if the struct evolves.
Sourcepub fn claimed(&self) -> &[T]
pub fn claimed(&self) -> &[T]
Every frame currently on the stack, concatenated — the collector’s door for the shadow instantiation, and the crash snapshot’s for the debug ones.