Skip to content

Commit

Permalink
feat: add Opcode::modifies_memory back (#1421)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored May 15, 2024
1 parent 84d1372 commit 4763c8b
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions crates/interpreter/src/opcode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,28 @@ impl OpCode {
pub const fn get(self) -> u8 {
self.0
}

/// Returns true if the opcode modifies memory.
/// <https://bluealloy.github.io/revm/crates/interpreter/memory.html#opcodes>
/// <https://github.com/crytic/evm-opcodes>
#[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.
Expand Down

0 comments on commit 4763c8b

Please sign in to comment.