diff --git a/core/vm/interpreter.go b/core/vm/interpreter.go index d4f55a33cfbf..5126a7e27653 100644 --- a/core/vm/interpreter.go +++ b/core/vm/interpreter.go @@ -113,10 +113,11 @@ func (evm *EVM) Run(contract *Contract, input []byte, readOnly bool) (ret []byte } var ( - op OpCode // current opcode - mem = NewMemory() // bound memory - stack = newstack() // local stack - callContext = &ScopeContext{ + op OpCode // current opcode + jumpTable *JumpTable = evm.table + mem = NewMemory() // bound memory + stack = newstack() // local stack + callContext = &ScopeContext{ Memory: mem, Stack: stack, Contract: contract, @@ -159,6 +160,7 @@ func (evm *EVM) Run(contract *Contract, input []byte, readOnly bool) (ret []byte // explicit STOP, RETURN or SELFDESTRUCT is executed, an error occurred during // the execution of one of the operations or until the done flag is set by the // parent context. + _ = jumpTable[0] // nil-check the jumpTable out of the loop for { if debug { // Capture pre-execution values for tracing. @@ -168,7 +170,7 @@ func (evm *EVM) Run(contract *Contract, input []byte, readOnly bool) (ret []byte // Get the operation from the jump table and validate the stack to ensure there are // enough stack items available to perform the operation. op = contract.GetOp(pc) - operation := evm.table[op] + operation := jumpTable[op] cost = operation.constantGas // For tracing // Validate stack if sLen := stack.len(); sLen < operation.minStack {