aboutsummaryrefslogtreecommitdiffstats
path: root/core/vm/jump_table.go
diff options
context:
space:
mode:
authorJeffrey Wilcke <geffobscura@gmail.com>2016-01-21 22:29:58 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2016-03-23 07:04:00 +0800
commit342ae7ce7dfd7a0eab2dd06bfa65199825279f05 (patch)
tree4d90314e50e137bcd8ee837cbb396fee40e2bb4b /core/vm/jump_table.go
parent2855a93ede6e9437d05a82c2397d48744621db9b (diff)
downloaddexon-342ae7ce7dfd7a0eab2dd06bfa65199825279f05.tar
dexon-342ae7ce7dfd7a0eab2dd06bfa65199825279f05.tar.gz
dexon-342ae7ce7dfd7a0eab2dd06bfa65199825279f05.tar.bz2
dexon-342ae7ce7dfd7a0eab2dd06bfa65199825279f05.tar.lz
dexon-342ae7ce7dfd7a0eab2dd06bfa65199825279f05.tar.xz
dexon-342ae7ce7dfd7a0eab2dd06bfa65199825279f05.tar.zst
dexon-342ae7ce7dfd7a0eab2dd06bfa65199825279f05.zip
core, core/vm, tests: changed the initialisation behaviour of the EVM
The EVM was previously initialised and created for every CALL, CALLCODE, DELEGATECALL and CREATE. This PR changes this behaviour so that the same EVM can be used through the session and beyond as long as the Environment sticks around.
Diffstat (limited to 'core/vm/jump_table.go')
-rw-r--r--core/vm/jump_table.go12
1 files changed, 5 insertions, 7 deletions
diff --git a/core/vm/jump_table.go b/core/vm/jump_table.go
index 37d7bb160..8297d3e1d 100644
--- a/core/vm/jump_table.go
+++ b/core/vm/jump_table.go
@@ -13,19 +13,15 @@ type jumpPtr struct {
type vmJumpTable [256]jumpPtr
-func (jt vmJumpTable) init(blockNumber *big.Int) {
+func newJumpTable(blockNumber *big.Int) vmJumpTable {
+ var jumpTable vmJumpTable
+
// when initialising a new VM execution we must first check the homestead
// changes.
if params.IsHomestead(blockNumber) {
jumpTable[DELEGATECALL] = jumpPtr{opDelegateCall, true}
- } else {
- jumpTable[DELEGATECALL] = jumpPtr{nil, false}
}
-}
-var jumpTable vmJumpTable
-
-func init() {
jumpTable[ADD] = jumpPtr{opAdd, true}
jumpTable[SUB] = jumpPtr{opSub, true}
jumpTable[MUL] = jumpPtr{opMul, true}
@@ -156,4 +152,6 @@ func init() {
jumpTable[JUMP] = jumpPtr{nil, true}
jumpTable[JUMPI] = jumpPtr{nil, true}
jumpTable[STOP] = jumpPtr{nil, true}
+
+ return jumpTable
}