Struct passerine::vm::stack::Stack[][src]

pub struct Stack {
    pub frames: Vec<usize>,
    pub stack: Vec<Tagged>,
}
Expand description

A stack of Tagged Data. Note that in general the stack is expected to follow the following pattern:

FV...V...F V...T... ...

Or in other words, a frame followed by a block of n values that are locals followed by n temporaries, ad infinitum.

Fields

frames: Vec<usize>stack: Vec<Tagged>

Implementations

Create a new Stack with a single frame.

Pushes some Data onto the Stack, tagging it along the way

Pushes some Tagged Data onto the Stack without unwrapping it.

Pops some Data of the Stack, panicking if what it pops is not Data. Note that this will never return a Heaped value, rather cloning the value inside.

Pops a stack frame from the Stack, restoring the previous frame. Panics if there are no frames left on the stack.

Pushes a new stack frame onto the Stack. Takes the old suspended closure / ip, and stores that on the stack.

Shorcut for pushing a Tagged(Slot::NotInit) on top of the stack.

Shortcut for calling push_not_init N times.

Wraps the top data value on the stack in Data::Heaped, data must not already be on the heap

Truncates the stack to the last frame. Returns true if the stack can not be unwound further.

returns a copy of the Slot of a local variable on the stack.

Returns a copy of the Data stored in a local variable on the stack.

Sets a local - note that this function doesn’t do much. It’s a simple swap-and-drop. If a new local is being declared, it’s literally a bounds-check and no-op.

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.