Skip to content

Commit

Permalink
Helpers for stack frame information
Browse files Browse the repository at this point in the history
  • Loading branch information
ecton committed Apr 4, 2024
1 parent 6cc847b commit 928ad63
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1005,7 +1005,7 @@ impl VmContext<'_, '_> {
Ordering::Equal => return Ok(StepResult::Complete),
Ordering::Greater => return Err(Fault::InvalidInstructionAddress),
};
println!("Executing {instruction:?}");
// println!("Executing {instruction:?}");
let next_instruction = StepResult::from(address.checked_add(1));
let result = match instruction {
LoadedOp::Return => return Ok(StepResult::Complete),
Expand Down Expand Up @@ -2448,6 +2448,16 @@ impl StackFrame {
Self { code, instruction }
}

#[must_use]
pub const fn code(&self) -> &Code {
&self.code
}

#[must_use]
pub const fn instruction(&self) -> usize {
self.instruction
}

#[must_use]
pub fn source_range(&self) -> Option<SourceRange> {
self.code.data.map.get(self.instruction)
Expand Down

0 comments on commit 928ad63

Please sign in to comment.