gwr/exec/stack
Types
https://webassembly.github.io/spec/core/exec/runtime.html#stack
pub type Stack {
Stack(entries: List(StackEntry))
}
Constructors
-
Stack(entries: List(StackEntry))
https://webassembly.github.io/spec/core/exec/runtime.html#stack
pub type StackEntry {
ValueEntry(spec.Value)
LabelEntry(spec.Label)
ActivationEntry(spec.Frame)
}
Constructors
-
ValueEntry(spec.Value) -
LabelEntry(spec.Label) -
ActivationEntry(spec.Frame)
Values
pub fn count_on_top(
from stack: Stack,
with predicate: fn(StackEntry) -> Bool,
) -> Int
pub fn get_current_frame(
from stack: Stack,
) -> Result(spec.Frame, Nil)
pub fn get_current_label(
from stack: Stack,
) -> Result(spec.Label, Nil)
pub fn get_entries(from stack: Stack) -> List(StackEntry)
pub fn is_activation_frame(entry: StackEntry) -> Bool
pub fn is_label(entry: StackEntry) -> Bool
pub fn is_value(entry: StackEntry) -> Bool
pub fn peek(from stack: Stack) -> option.Option(StackEntry)
pub fn pop(
from stack: Stack,
) -> #(Stack, option.Option(StackEntry))
pub fn pop_all(from stack: Stack) -> #(Stack, List(StackEntry))
pub fn pop_as(
from stack: Stack,
with convert: fn(StackEntry) -> Result(a, trap.Trap),
) -> Result(#(Stack, a), trap.Trap)
pub fn pop_if(
from stack: Stack,
with predicate: fn(StackEntry) -> Bool,
) -> Result(#(Stack, StackEntry), Nil)
pub fn pop_repeat(
from stack: Stack,
up_to count: Int,
) -> #(Stack, List(StackEntry))
pub fn pop_while(
from stack: Stack,
with predicate: fn(StackEntry) -> Bool,
) -> #(Stack, List(StackEntry))
pub fn push(
to stack: Stack,
push new_entries: List(StackEntry),
) -> Stack
pub fn replace_current_frame(
from stack: Stack,
with new_frame: spec.Frame,
) -> Result(Stack, Nil)
pub fn to_frame(
entry: StackEntry,
) -> Result(spec.Frame, trap.Trap)
pub fn to_label(
entry: StackEntry,
) -> Result(spec.Label, trap.Trap)
pub fn to_value(
entry: StackEntry,
) -> Result(spec.Value, trap.Trap)