Skip to content

Commit

Permalink
Merge branch 'stable-tracer-interface' into fvs-circuit-statistics-tr…
Browse files Browse the repository at this point in the history
…acers-interface
  • Loading branch information
montekki authored Aug 21, 2024
2 parents d210848 + 63b40ce commit 085a91e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/callframe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ impl<T> Callframe<T> {

context_u128: self.context_u128,
sp: self.sp,
pc: self.get_pc_as_u16(),
gas: self.gas,
near_calls: self.near_calls.clone(),
heap_size: self.heap_size,
Expand All @@ -189,6 +190,7 @@ impl<T> Callframe<T> {
stack,
context_u128,
sp,
pc,
gas,
near_calls,
heap_size,
Expand All @@ -200,6 +202,7 @@ impl<T> Callframe<T> {

self.context_u128 = context_u128;
self.sp = sp;
self.set_pc_from_u16(pc);
self.gas = gas;
self.near_calls = near_calls;
self.heap_size = heap_size;
Expand All @@ -221,6 +224,7 @@ pub(crate) struct CallframeSnapshot {
stack: StackSnapshot,
context_u128: u128,
sp: u16,
pc: u16,
gas: u32,
near_calls: Vec<NearCallFrame>,
heap_size: u32,
Expand Down
4 changes: 4 additions & 0 deletions src/instruction_handlers/ret.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ fn ret<T: Tracer, RT: TypeLevelReturnType, const TO_LABEL: bool>(
// the caller may take external snapshots while the VM is in the initial frame and
// these would break were the initial frame to be rolled back.

// But to continue execution would be nonsensical and can cause UB because there
// is no next instruction after a panic arising from some other instruction.
vm.state.current_frame.pc = invalid_instruction();

return if let Some(return_value) = return_value_or_panic {
let output = vm.state.heaps[return_value.memory_page]
.read_range_big_endian(
Expand Down

0 comments on commit 085a91e

Please sign in to comment.