Skip to main content

SlotStackHeader

Struct SlotStackHeader 

Source
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>

Source

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.

Source

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.

Source

pub fn len(&self) -> usize

How many slots are currently claimed. Zero between runs, if every prologue was balanced by an epilogue.

Source

pub fn is_empty(&self) -> bool

True iff no frame is on the stack.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.