Trait SubRoutineStack
pub trait SubRoutineStack {
// Required methods
fn len(&self) -> usize;
fn routine_idx(&self) -> usize;
fn set_routine_idx(&mut self, idx: usize);
fn push(&mut self, old_program_counter: usize, new_idx: usize) -> bool;
fn pop(&mut self) -> Option<usize>;
// Provided method
fn is_empty(&self) -> bool { ... }
}
Expand description
Handles EOF introduced sub routine calls.
Required Methods§
fn routine_idx(&self) -> usize
fn routine_idx(&self) -> usize
Returns current sub routine index.
fn set_routine_idx(&mut self, idx: usize)
fn set_routine_idx(&mut self, idx: usize)
Sets new code section without touching subroutine stack.
This is used for bytecode::opcode::JUMPF
opcode. Where
tail call is performed.