diff --git a/crates/inspector/src/handler.rs b/crates/inspector/src/handler.rs index ba2b8570d5..2b65c7bdf7 100644 --- a/crates/inspector/src/handler.rs +++ b/crates/inspector/src/handler.rs @@ -191,6 +191,7 @@ where // Call Inspector step. inspector.step(interpreter, context); if interpreter.bytecode.is_end() { + inspector.step_end(interpreter, context); break; } @@ -215,18 +216,18 @@ where log_num = new_log; } - // if loops is ending, break the loop so we can revert to the previous pointer and then call step_end. - if interpreter.bytecode.is_end() { - break; - } + // // if loops is ending, break the loop so we can revert to the previous pointer and then call step_end. + // if interpreter.bytecode.is_end() { + // break; + // } // Call step_end. inspector.step_end(interpreter, context); } interpreter.bytecode.revert_to_previous_pointer(); - // call step_end again to handle the last instruction - inspector.step_end(interpreter, context); + // // call step_end again to handle the last instruction + // inspector.step_end(interpreter, context); let next_action = interpreter.take_next_action(); diff --git a/crates/interpreter/src/interpreter/ext_bytecode.rs b/crates/interpreter/src/interpreter/ext_bytecode.rs index ede6bfcb02..5db45928fa 100644 --- a/crates/interpreter/src/interpreter/ext_bytecode.rs +++ b/crates/interpreter/src/interpreter/ext_bytecode.rs @@ -1,7 +1,7 @@ use super::{Immediates, Jumps, LegacyBytecode}; use crate::{interpreter_types::LoopControl, InterpreterAction}; use bytecode::{utils::read_u16, Bytecode}; -use core::{ops::Deref, ptr}; +use core::ops::Deref; use primitives::B256; #[cfg(feature = "serde")] @@ -17,9 +17,11 @@ pub struct ExtBytecode { /// The base bytecode. base: Bytecode, /// The previous instruction pointer. - previous_pointer: Option<*const u8>, + //previous_pointer: Option<*const u8>, /// The current instruction pointer. instruction_pointer: *const u8, + /// End flag that stop execution. + end_flag: bool, } impl Deref for ExtBytecode { @@ -47,7 +49,8 @@ impl ExtBytecode { instruction_pointer, bytecode_hash: None, action: None, - previous_pointer: None, + //previous_pointer: None, + end_flag: false, } } @@ -59,7 +62,8 @@ impl ExtBytecode { instruction_pointer, bytecode_hash: Some(hash), action: None, - previous_pointer: None, + //previous_pointer: None, + end_flag: false, } } @@ -79,23 +83,25 @@ impl ExtBytecode { impl LoopControl for ExtBytecode { #[inline] fn is_end(&self) -> bool { - self.instruction_pointer.is_null() + self.end_flag } #[inline] fn revert_to_previous_pointer(&mut self) { - if let Some(previous_pointer) = self.previous_pointer { - self.instruction_pointer = previous_pointer; - } + self.end_flag = false; + // if let Some(previous_pointer) = self.previous_pointer { + // self.instruction_pointer = previous_pointer; + // } } #[inline] fn set_action(&mut self, action: InterpreterAction) { self.action = Some(action); - self.previous_pointer = Some(core::mem::replace( - &mut self.instruction_pointer, - ptr::null(), - )); + self.end_flag = true; + // self.previous_pointer = Some(core::mem::replace( + // &mut self.instruction_pointer, + // ptr::null(), + // )); } #[inline]