diff options
Diffstat (limited to 'core/vm/vm.go')
-rw-r--r-- | core/vm/vm.go | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/core/vm/vm.go b/core/vm/vm.go index 95d27c64c..26df8aef4 100644 --- a/core/vm/vm.go +++ b/core/vm/vm.go @@ -30,15 +30,12 @@ import ( // Vm is an EVM and implements VirtualMachine type Vm struct { - env Environment + env Environment + jumpTable vmJumpTable } -// New returns a new Vm -func New(env Environment) *Vm { - // init the jump table. Also prepares the homestead changes - jumpTable.init(env.BlockNumber()) - - return &Vm{env: env} +func EVM(env Environment) *Vm { + return &Vm{env: env, jumpTable: newJumpTable(env.BlockNumber())} } // Run loops and evaluates the contract's code with the given input data @@ -169,7 +166,7 @@ func (self *Vm) Run(contract *Contract, input []byte) (ret []byte, err error) { mem.Resize(newMemSize.Uint64()) // Add a log message self.log(pc, op, contract.Gas, cost, mem, stack, contract, nil) - if opPtr := jumpTable[op]; opPtr.valid { + if opPtr := self.jumpTable[op]; opPtr.valid { if opPtr.fn != nil { opPtr.fn(instruction{}, &pc, self.env, contract, mem, stack) } else { |