diff options
author | obscuren <geffobscura@gmail.com> | 2015-06-10 03:12:25 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-06-10 03:12:25 +0800 |
commit | bac9a94ddf20dc530966cbf6cd384aaf94aedc77 (patch) | |
tree | 0ced967e60315698cc5056a984d7678c417bc1ce /core/vm/vm.go | |
parent | 0e703d92ac9df61e2ededa8c895c70ded101a607 (diff) | |
parent | 14994fa21bf6f05554ff370d41005d06b68d20a5 (diff) | |
download | dexon-bac9a94ddf20dc530966cbf6cd384aaf94aedc77.tar dexon-bac9a94ddf20dc530966cbf6cd384aaf94aedc77.tar.gz dexon-bac9a94ddf20dc530966cbf6cd384aaf94aedc77.tar.bz2 dexon-bac9a94ddf20dc530966cbf6cd384aaf94aedc77.tar.lz dexon-bac9a94ddf20dc530966cbf6cd384aaf94aedc77.tar.xz dexon-bac9a94ddf20dc530966cbf6cd384aaf94aedc77.tar.zst dexon-bac9a94ddf20dc530966cbf6cd384aaf94aedc77.zip |
Merge branch 'release/0.9.28'
Diffstat (limited to 'core/vm/vm.go')
-rw-r--r-- | core/vm/vm.go | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/core/vm/vm.go b/core/vm/vm.go index 6db99bdcc..2bd950385 100644 --- a/core/vm/vm.go +++ b/core/vm/vm.go @@ -71,18 +71,22 @@ func (self *Vm) Run(context *Context, callData []byte) (ret []byte, err error) { } } - var ( - op OpCode + // Don't bother with the execution if there's no code. + if len(code) == 0 { + return context.Return(nil), nil + } - destinations = analyseJumpDests(context.Code) - mem = NewMemory() - stack = newStack() - pc = new(big.Int) - statedb = self.env.State() + var ( + op OpCode + codehash = crypto.Sha3Hash(code) + mem = NewMemory() + stack = newStack() + pc = new(big.Int) + statedb = self.env.State() jump = func(from *big.Int, to *big.Int) error { - nop := context.GetOp(to) - if !destinations.Has(to) { + if !context.jumpdests.has(codehash, code, to) { + nop := context.GetOp(to) return fmt.Errorf("invalid jump destination (%v) %v", nop, to) } @@ -95,11 +99,6 @@ func (self *Vm) Run(context *Context, callData []byte) (ret []byte, err error) { } ) - // Don't bother with the execution if there's no code. - if len(code) == 0 { - return context.Return(nil), nil - } - for { // The base for all big integer arithmetic base := new(big.Int) |