diff --git a/crates/interpreter/src/opcode.rs b/crates/interpreter/src/opcode.rs index 28483a1a9f..b5b6ffd17c 100644 --- a/crates/interpreter/src/opcode.rs +++ b/crates/interpreter/src/opcode.rs @@ -313,6 +313,28 @@ impl OpCode { pub const fn get(self) -> u8 { self.0 } + + /// Returns true if the opcode modifies memory. + /// + /// + #[inline] + pub const fn modifies_memory(&self) -> bool { + matches!( + *self, + OpCode::EXTCODECOPY + | OpCode::MLOAD + | OpCode::MSTORE + | OpCode::MSTORE8 + | OpCode::MCOPY + | OpCode::CODECOPY + | OpCode::CALLDATACOPY + | OpCode::RETURNDATACOPY + | OpCode::CALL + | OpCode::CALLCODE + | OpCode::DELEGATECALL + | OpCode::STATICCALL + ) + } } /// Information about opcode, such as name, and stack inputs and outputs.