aboutsummaryrefslogtreecommitdiffstats
path: root/core/vm/jump_table.go
diff options
context:
space:
mode:
Diffstat (limited to 'core/vm/jump_table.go')
-rw-r--r--core/vm/jump_table.go23
1 files changed, 19 insertions, 4 deletions
diff --git a/core/vm/jump_table.go b/core/vm/jump_table.go
index 222c93854..37d7bb160 100644
--- a/core/vm/jump_table.go
+++ b/core/vm/jump_table.go
@@ -1,13 +1,29 @@
package vm
-import "math/big"
+import (
+ "math/big"
+
+ "github.com/ethereum/go-ethereum/params"
+)
type jumpPtr struct {
fn instrFn
valid bool
}
-var jumpTable [256]jumpPtr
+type vmJumpTable [256]jumpPtr
+
+func (jt vmJumpTable) init(blockNumber *big.Int) {
+ // 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}
@@ -62,10 +78,9 @@ func init() {
jumpTable[PC] = jumpPtr{nil, true}
jumpTable[MSIZE] = jumpPtr{opMsize, true}
jumpTable[GAS] = jumpPtr{opGas, true}
- jumpTable[CREATE] = jumpPtr{nil, true}
+ jumpTable[CREATE] = jumpPtr{opCreate, true}
jumpTable[CALL] = jumpPtr{opCall, true}
jumpTable[CALLCODE] = jumpPtr{opCallCode, true}
- jumpTable[DELEGATECALL] = jumpPtr{opDelegateCall, true}
jumpTable[LOG0] = jumpPtr{makeLog(0), true}
jumpTable[LOG1] = jumpPtr{makeLog(1), true}
jumpTable[LOG2] = jumpPtr{makeLog(2), true}