pub struct FramedInterpreter {
pub stack: Vec<StackValue>,
pub locals: Vec<StackValue>,
pub frames: Vec<CallFrame>,
pub ip: usize,
pub max_depth: usize,
}Expand description
An interpreter that manages a proper call frame stack.
Fields§
§stack: Vec<StackValue>The operand stack.
locals: Vec<StackValue>All local variables across all frames (flat layout).
frames: Vec<CallFrame>Frame stack (innermost at the back).
ip: usizeCurrent instruction pointer.
max_depth: usizeMaximum frame depth (0 = unlimited).
Implementations§
Source§impl FramedInterpreter
impl FramedInterpreter
Sourcepub fn with_max_depth(self, d: usize) -> Self
pub fn with_max_depth(self, d: usize) -> Self
Set the maximum call depth.
Sourcepub fn push_frame(
&mut self,
return_ip: usize,
fn_name: &str,
) -> Result<(), String>
pub fn push_frame( &mut self, return_ip: usize, fn_name: &str, ) -> Result<(), String>
Push a new call frame, saving return_ip and recording locals_base.
Sourcepub fn pop_frame(&mut self) -> Option<usize>
pub fn pop_frame(&mut self) -> Option<usize>
Pop the top call frame and restore the instruction pointer.
Sourcepub fn stack_trace(&self) -> String
pub fn stack_trace(&self) -> String
Pretty-print the current call stack trace.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FramedInterpreter
impl RefUnwindSafe for FramedInterpreter
impl Send for FramedInterpreter
impl Sync for FramedInterpreter
impl Unpin for FramedInterpreter
impl UnsafeUnpin for FramedInterpreter
impl UnwindSafe for FramedInterpreter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more