diff --git a/core/vm/instructions.go b/core/vm/instructions.go index 5195e716b2..a1188848dc 100644 --- a/core/vm/instructions.go +++ b/core/vm/instructions.go @@ -886,6 +886,21 @@ func opSuicide(pc *uint64, interpreter *EVMInterpreter, contract *Contract, memo return nil, nil } +// opPush1 is a specialized version of pushN +func opPush1(pc *uint64, interpreter *EVMInterpreter, contract *Contract, memory *Memory, stack *Stack) ([]byte, error) { + var ( + codeLen = uint64(len(contract.Code)) + integer = interpreter.intPool.get() + ) + *pc += 1 + if *pc < codeLen { + stack.push(integer.SetUint64(uint64(contract.Code[*pc]))) + } else { + stack.push(integer.SetUint64(0)) + } + return nil, nil +} + // following functions are used by the instruction jump table // make log instruction function diff --git a/core/vm/jump_table.go b/core/vm/jump_table.go index dde11dacf1..90d8e64dba 100644 --- a/core/vm/jump_table.go +++ b/core/vm/jump_table.go @@ -567,7 +567,7 @@ func newFrontierInstructionSet() [256]operation { valid: true, }, PUSH1: { - execute: makePush(1, 1), + execute: opPush1, constantGas: GasFastestStep, minStack: minStack(0, 1), maxStack: maxStack(0, 1),