pub struct CallStack { /* private fields */ }Expand description
The kernel-internal call stack.
The stack drives control transfer (CALL/yield/HALT) and provides the structural invocation boundary that gives v3 its fault atomicity and yield-resume linearity (§3 “Why hierarchy is the invocation boundary”).
Implementations§
Source§impl CallStack
impl CallStack
pub fn new(max_depth: usize) -> Self
pub fn with_default_depth() -> Self
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn entries(&self) -> &[Entry]
Sourcepub fn entries_mut(&mut self) -> &mut [Entry]
pub fn entries_mut(&mut self) -> &mut [Entry]
Mutable slice into entries — used by the driver to save live regs/mem/gas back into a specific InstanceEntry by position after the interpreter exits (e.g. saving the yielder’s state while a ReferenceEntry sits on top).
Sourcepub fn push_instance(&mut self, entry: InstanceEntry) -> Result<(), VmError>
pub fn push_instance(&mut self, entry: InstanceEntry) -> Result<(), VmError>
Push a fresh InstanceEntry. Transitions any prior top from
Running to Waiting; the new entry becomes Running.
Sourcepub fn push_reference(&mut self, target_position: usize) -> Result<(), VmError>
pub fn push_reference(&mut self, target_position: usize) -> Result<(), VmError>
Push a ReferenceEntry pointing at an InstanceEntry earlier on
the stack. The reference becomes Running; the prior top
drops to Waiting.
Sourcepub fn pop(&mut self) -> Option<Entry>
pub fn pop(&mut self) -> Option<Entry>
Pop the top entry. The next entry (if any) is promoted from
Waiting to Running.
pub fn running_mut(&mut self) -> Option<&mut Entry>
Sourcepub fn running_instance(&self) -> Option<&InstanceEntry>
pub fn running_instance(&self) -> Option<&InstanceEntry>
Resolve a ReferenceEntry’s effective InstanceEntry.
If the top is an InstanceEntry, returns it; if it’s a
ReferenceEntry, follows the target_position link.
pub fn running_instance_mut(&mut self) -> Option<&mut InstanceEntry>
Sourcepub fn enforce_invariants(&self) -> Result<(), VmError>
pub fn enforce_invariants(&self) -> Result<(), VmError>
Debug-build assertion of the v3 stack invariants. Real callers should rely on the push/pop primitives to maintain them; this is for testing the construction primitives themselves.