diff options
author | Martin Holst Swende <martin@swende.se> | 2018-10-04 23:15:37 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2018-10-04 23:15:37 +0800 |
commit | 89a32451aeb418db3fd5d9c427a0c29fddb1e85b (patch) | |
tree | 24df0d470d52030635712364a947bc7a8293d366 /core/vm/analysis.go | |
parent | 8c63d0d2e44128c6a0f12fb9db8f0a32528b4a7d (diff) | |
download | dexon-89a32451aeb418db3fd5d9c427a0c29fddb1e85b.tar.gz dexon-89a32451aeb418db3fd5d9c427a0c29fddb1e85b.tar.zst dexon-89a32451aeb418db3fd5d9c427a0c29fddb1e85b.zip |
core/vm: faster create/create2 (#17806)
* core/vm/runtim: benchmark create/create2
* core/vm: do less hashing in CREATE2
* core/vm: avoid storing jumpdest analysis for initcode
* core/vm: avoid unneccesary lookups, remove unused fields
* core/vm: go formatting tests
* core/vm: save jumpdest analysis locally
* core/vm: use common.Hash instead of nil, fix review comments
* core/vm: removed type destinations
* core/vm: correct check for empty hash
* eth: more elegant api_tracer
* core/vm: address review concerns
Diffstat (limited to 'core/vm/analysis.go')
-rw-r--r-- | core/vm/analysis.go | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/core/vm/analysis.go b/core/vm/analysis.go index f9c4298d3..0ccf47b97 100644 --- a/core/vm/analysis.go +++ b/core/vm/analysis.go @@ -16,34 +16,6 @@ package vm -import ( - "math/big" - - "github.com/ethereum/go-ethereum/common" -) - -// destinations stores one map per contract (keyed by hash of code). -// The maps contain an entry for each location of a JUMPDEST -// instruction. -type destinations map[common.Hash]bitvec - -// has checks whether code has a JUMPDEST at dest. -func (d destinations) has(codehash common.Hash, code []byte, dest *big.Int) bool { - // PC cannot go beyond len(code) and certainly can't be bigger than 63bits. - // Don't bother checking for JUMPDEST in that case. - udest := dest.Uint64() - if dest.BitLen() >= 63 || udest >= uint64(len(code)) { - return false - } - - m, analysed := d[codehash] - if !analysed { - m = codeBitmap(code) - d[codehash] = m - } - return OpCode(code[udest]) == JUMPDEST && m.codeSegment(udest) -} - // bitvec is a bit vector which maps bytes in a program. // An unset bit means the byte is an opcode, a set bit means // it's data (i.e. argument of PUSHxx). |