#[repr(C)]pub struct TaggedStack {
pub base: *mut StackValue,
pub sp: usize,
pub capacity: usize,
}Expand description
Stack state for the tagged value stack
This struct is passed to/from runtime functions and represents the complete state of a strand’s value stack.
Uses 32-byte StackValue slots for FFI compatibility.
Fields§
§base: *mut StackValuePointer to the base of the stack array (array of StackValue)
sp: usizeCurrent stack pointer (index into array, points to next free slot)
capacity: usizeTotal capacity of the stack (number of slots)
Implementations§
Source§impl TaggedStack
impl TaggedStack
Sourcepub fn with_default_capacity() -> Self
pub fn with_default_capacity() -> Self
Create a new tagged stack with default capacity
Sourcepub fn has_capacity(&self, n: usize) -> bool
pub fn has_capacity(&self, n: usize) -> bool
Check if the stack has room for n more values
Sourcepub fn grow(&mut self, min_capacity: usize)
pub fn grow(&mut self, min_capacity: usize)
Grow the stack to accommodate more values
Doubles capacity by default, or grows to min_capacity if larger.
Sourcepub fn push(&mut self, val: StackValue)
pub fn push(&mut self, val: StackValue)
Push a StackValue onto the stack
Grows the stack if necessary.
Sourcepub fn pop(&mut self) -> StackValue
pub fn pop(&mut self) -> StackValue
Pop a StackValue from the stack
Panics if the stack is empty.
Sourcepub fn peek(&self) -> StackValue
pub fn peek(&self) -> StackValue
Peek at the top value without removing it
Panics if the stack is empty.
Sourcepub fn sp_ptr(&self) -> *mut StackValue
pub fn sp_ptr(&self) -> *mut StackValue
Get a pointer to the current stack pointer position
This is used by generated code for inline stack operations. Returns pointer to next free StackValue slot.
Sourcepub fn push_int(&mut self, val: i64)
pub fn push_int(&mut self, val: i64)
Push an integer value using Value::Int layout slot0 = 0 (Int discriminant), slot1 = value
Sourcepub fn pop_int(&mut self) -> i64
pub fn pop_int(&mut self) -> i64
Pop and return an integer value
Panics if the top value is not an integer.
Sourcepub fn clone_stack(&self) -> Self
pub fn clone_stack(&self) -> Self
Clone this stack (for spawn)
Creates a deep copy. For heap objects, properly clones them using the clone_stack_value function which handles each type correctly.