aboutsummaryrefslogtreecommitdiff
path: root/core/vm/opcodes.go
diff options
context:
space:
mode:
Diffstat (limited to 'core/vm/opcodes.go')
-rw-r--r--core/vm/opcodes.go62
1 files changed, 37 insertions, 25 deletions
diff --git a/core/vm/opcodes.go b/core/vm/opcodes.go
index 1a66ef8..99688b1 100644
--- a/core/vm/opcodes.go
+++ b/core/vm/opcodes.go
@@ -70,7 +70,7 @@ const (
SHR
SAR
- SHA3 = 0x20
+ SHA3 OpCode = 0x20
)
// 0x30 range - closure state.
@@ -101,26 +101,27 @@ const (
NUMBER
DIFFICULTY
GASLIMIT
- CHAINID = 0x46
- SELFBALANCE = 0x47
+ CHAINID OpCode = 0x46
+ SELFBALANCE OpCode = 0x47
)
// 0x50 range - 'storage' and execution.
const (
- POP OpCode = 0x50 + iota
- MLOAD
- MSTORE
- MSTORE8
- SLOAD
- SSTORE
- JUMP
- JUMPI
- PC
- MSIZE
- GAS
- JUMPDEST
- EMC = 0x5c
- BALANCEMC = 0x5d
+ POP OpCode = 0x50
+ MLOAD OpCode = 0x51
+ MSTORE OpCode = 0x52
+ MSTORE8 OpCode = 0x53
+ SLOAD OpCode = 0x54
+ SSTORE OpCode = 0x55
+ JUMP OpCode = 0x56
+ JUMPI OpCode = 0x57
+ PC OpCode = 0x58
+ MSIZE OpCode = 0x59
+ GAS OpCode = 0x5a
+ JUMPDEST OpCode = 0x5b
+ BEGINSUB OpCode = 0x5c
+ RETURNSUB OpCode = 0x5d
+ JUMPSUB OpCode = 0x5e
)
// 0x60 range.
@@ -207,6 +208,12 @@ const (
SWAP
)
+const (
+ BALANCEMC = 0xcd
+ EMC = 0xce
+ CALLEX = 0xcf
+)
+
// 0xf0 range - closures.
const (
CREATE OpCode = 0xf0 + iota
@@ -215,11 +222,9 @@ const (
RETURN
DELEGATECALL
CREATE2
- CALLEX = 0xf6
- STATICCALL = 0xfa
-
- REVERT = 0xfd
- SELFDESTRUCT = 0xff
+ STATICCALL OpCode = 0xfa
+ REVERT OpCode = 0xfd
+ SELFDESTRUCT OpCode = 0xff
)
// Since the opcodes aren't all in order we can't use a regular slice.
@@ -301,7 +306,10 @@ var opCodeToString = map[OpCode]string{
MSIZE: "MSIZE",
GAS: "GAS",
JUMPDEST: "JUMPDEST",
- EMC: "EMC",
+
+ BEGINSUB: "BEGINSUB",
+ JUMPSUB: "JUMPSUB",
+ RETURNSUB: "RETURNSUB",
// 0x60 range - push.
PUSH1: "PUSH1",
@@ -379,6 +387,7 @@ var opCodeToString = map[OpCode]string{
// 0xf0 range.
CREATE: "CREATE",
CALL: "CALL",
+ EMC: "EMC",
CALLEX: "CALLEX",
RETURN: "RETURN",
CALLCODE: "CALLCODE",
@@ -396,7 +405,7 @@ var opCodeToString = map[OpCode]string{
func (op OpCode) String() string {
str := opCodeToString[op]
if len(str) == 0 {
- return fmt.Sprintf("Missing opcode 0x%x", int(op))
+ return fmt.Sprintf("opcode 0x%x not defined", int(op))
}
return str
@@ -469,7 +478,9 @@ var stringToOp = map[string]OpCode{
"MSIZE": MSIZE,
"GAS": GAS,
"JUMPDEST": JUMPDEST,
- "EMC": EMC,
+ "BEGINSUB": BEGINSUB,
+ "RETURNSUB": RETURNSUB,
+ "JUMPSUB": JUMPSUB,
"PUSH1": PUSH1,
"PUSH2": PUSH2,
"PUSH3": PUSH3,
@@ -542,6 +553,7 @@ var stringToOp = map[string]OpCode{
"CREATE": CREATE,
"CREATE2": CREATE2,
"CALL": CALL,
+ "EMC": EMC,
"CALLEX": CALLEX,
"RETURN": RETURN,
"CALLCODE": CALLCODE,