diff options
author | Péter Szilágyi <peterke@gmail.com> | 2016-10-01 21:58:49 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-01 21:58:49 +0800 |
commit | 0731b44809f72ed5880dc3654ee70ae85420bd77 (patch) | |
tree | 68eb52c91a136e820f3656e394847c4e695afa63 /core/vm/vm.go | |
parent | d8715fba1a366944a069397775fc52a30358eff3 (diff) | |
parent | cb84e3f02953f2df166ae69369d222dcbbd7d78d (diff) | |
download | dexon-0731b44809f72ed5880dc3654ee70ae85420bd77.tar dexon-0731b44809f72ed5880dc3654ee70ae85420bd77.tar.gz dexon-0731b44809f72ed5880dc3654ee70ae85420bd77.tar.bz2 dexon-0731b44809f72ed5880dc3654ee70ae85420bd77.tar.lz dexon-0731b44809f72ed5880dc3654ee70ae85420bd77.tar.xz dexon-0731b44809f72ed5880dc3654ee70ae85420bd77.tar.zst dexon-0731b44809f72ed5880dc3654ee70ae85420bd77.zip |
Merge pull request #3067 from karalabe/vm-avoid-hashing
cmd, core, internal, light, tests: avoid hashing the code in the VM
Diffstat (limited to 'core/vm/vm.go')
-rw-r--r-- | core/vm/vm.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/core/vm/vm.go b/core/vm/vm.go index 9d7b55058..5d78b4a2a 100644 --- a/core/vm/vm.go +++ b/core/vm/vm.go @@ -71,10 +71,11 @@ func (evm *EVM) Run(contract *Contract, input []byte) (ret []byte, err error) { return nil, nil } - var ( - codehash = crypto.Keccak256Hash(contract.Code) // codehash is used when doing jump dest caching - program *Program - ) + codehash := contract.CodeHash // codehash is used when doing jump dest caching + if codehash == (common.Hash{}) { + codehash = crypto.Keccak256Hash(contract.Code) + } + var program *Program if evm.cfg.EnableJit { // If the JIT is enabled check the status of the JIT program, // if it doesn't exist compile a new program in a separate |