Skip to content

Commit

Permalink
Simplify OP_PC
Browse files Browse the repository at this point in the history
  • Loading branch information
0xVolosnikov committed Nov 13, 2024
1 parent 397092d commit a33c871
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions system-contracts/contracts/EvmEmulator.yul
Original file line number Diff line number Diff line change
Expand Up @@ -2014,10 +2014,10 @@ object "EvmEmulator" {
}
case 0x58 { // OP_PC
evmGasLeft := chargeGas(evmGasLeft, 2)
ip := add(ip, 1)

// PC = ip - 32 (bytecode size) - 1 (current instruction)
sp, stackHead := pushStackItem(sp, sub(sub(ip, BYTECODE_LEN_OFFSET()), 33), stackHead)
sp, stackHead := pushStackItem(sp, sub(ip, BYTECODE_OFFSET()), stackHead)

ip := add(ip, 1)
}
case 0x59 { // OP_MSIZE
evmGasLeft := chargeGas(evmGasLeft, 2)
Expand Down Expand Up @@ -5062,10 +5062,10 @@ object "EvmEmulator" {
}
case 0x58 { // OP_PC
evmGasLeft := chargeGas(evmGasLeft, 2)
ip := add(ip, 1)

// PC = ip - 32 (bytecode size) - 1 (current instruction)
sp, stackHead := pushStackItem(sp, sub(sub(ip, BYTECODE_LEN_OFFSET()), 33), stackHead)
sp, stackHead := pushStackItem(sp, sub(ip, BYTECODE_OFFSET()), stackHead)

ip := add(ip, 1)
}
case 0x59 { // OP_MSIZE
evmGasLeft := chargeGas(evmGasLeft, 2)
Expand Down
6 changes: 3 additions & 3 deletions system-contracts/evm-emulator/EvmEmulatorLoop.template.yul
Original file line number Diff line number Diff line change
Expand Up @@ -789,10 +789,10 @@ for { } true { } {
}
case 0x58 { // OP_PC
evmGasLeft := chargeGas(evmGasLeft, 2)
ip := add(ip, 1)

// PC = ip - 32 (bytecode size) - 1 (current instruction)
sp, stackHead := pushStackItem(sp, sub(sub(ip, BYTECODE_LEN_OFFSET()), 33), stackHead)
sp, stackHead := pushStackItem(sp, sub(ip, BYTECODE_OFFSET()), stackHead)

ip := add(ip, 1)
}
case 0x59 { // OP_MSIZE
evmGasLeft := chargeGas(evmGasLeft, 2)
Expand Down

0 comments on commit a33c871

Please sign in to comment.