Struct stark::sail::eval::EvalStack [−][src]
pub struct EvalStack { stack_start: *mut usize, stack_max: *mut usize, stack_top: *mut usize, frame_start: *mut usize, pub null_loc: *mut usize, }
Expand description
Sail evaluation stack
Fields
stack_start: *mut usize
First (bottom) element of the stack
stack_max: *mut usize
Maximum stack element address
stack_top: *mut usize
Current top of the stack (frame_start is more useful)
frame_start: *mut usize
Start of the stack’s top frame
null_loc: *mut usize
Location to write discarded return values
Implementations
impl EvalStack
[src]
impl EvalStack
[src]pub fn push(&mut self, word: *mut SlHead)
[src]
pub fn push(&mut self, word: *mut SlHead)
[src]Pushes a single word to the stack, which will always be a pointer to a Sail object
pub fn push_frame_head(
&mut self,
ret: *mut *mut SlHead,
opc: Opcode,
env: *mut SlHead
)
[src]
pub fn push_frame_head(
&mut self,
ret: *mut *mut SlHead,
opc: Opcode,
env: *mut SlHead
)
[src]Push a complete frame head onto the stack
Components:
ret
: return address for this frame’s resultopc
: opcode which dictates this frame’s format & behaviorenv
: environment containing bindings for this frame
pub fn start(
&mut self,
ret: *mut *mut SlHead,
env: *mut SlHead,
expr: *mut SlHead
) -> bool
[src]
pub fn start(
&mut self,
ret: *mut *mut SlHead,
env: *mut SlHead,
expr: *mut SlHead
) -> bool
[src]Starts evaluating a Sail expression with an external return location
Returns false and does nothing if the stack is already in use
pub fn start_no_ret(&mut self, env: *mut SlHead, expr: *mut SlHead)
[src]
pub fn start_no_ret(&mut self, env: *mut SlHead, expr: *mut SlHead)
[src]Starts evaluating a Sail expression that will not return outside the stack
Works even when other expressions are evaluating on the stack
Warning:
- Takes over the stack until the expression is finished
- An error in this expression destroys the entire stack
- This function is temporary and using it is a bad idea
fn unwind(&mut self, error: *mut SlHead)
[src]
fn frame_top(&mut self) -> (*mut *mut SlHead, *mut SlHead, Opcode)
[src]
fn frame_top(&mut self) -> (*mut *mut SlHead, *mut SlHead, Opcode)
[src]Returns all frame head components of the current top frame
fn frame_addr(&mut self, offset: usize) -> *mut *mut SlHead
[src]
fn frame_addr(&mut self, offset: usize) -> *mut *mut SlHead
[src]Returns the address of a location offset into the current top frame
fn frame_obj(&mut self, offset: usize) -> *mut SlHead
[src]
fn frame_obj(&mut self, offset: usize) -> *mut SlHead
[src]Returns the pointer stored in a location offset into the current top frame
fn eval_expr(
&mut self,
ret: *mut *mut SlHead,
env: *mut SlHead,
expr: *mut SlHead
)
[src]
fn eval_expr(
&mut self,
ret: *mut *mut SlHead,
env: *mut SlHead,
expr: *mut SlHead
)
[src]Evaluates any Sail expression in object form, using the given environment and returning to the given location
pub fn iter_once(&mut self, reg: *mut Region, tbl: *mut SlHead)
[src]
pub fn iter_once(&mut self, reg: *mut Region, tbl: *mut SlHead)
[src]Consumes one frame off the top of the stack and executes it
This is the core of Sail evaluation logic. In the absence of code with infinite loops, executing this function repeatedly will evaluate any Sail expression. It handles all defined opcodes and adds more frames to the stack as necessary, but never uses recursion.