core/vm: don't use iota for opcode definitions

This commit is contained in:
Martin Holst Swende 2021-11-18 09:50:52 +01:00
parent 16341e0563
commit ab31fbbde1
No known key found for this signature in database
GPG Key ID: 683B438C05A5DDF0

@ -39,68 +39,68 @@ func (op OpCode) IsStaticJump() bool {
// 0x0 range - arithmetic ops. // 0x0 range - arithmetic ops.
const ( const (
STOP OpCode = iota STOP OpCode = 0x0
ADD ADD OpCode = 0x1
MUL MUL OpCode = 0x2
SUB SUB OpCode = 0x3
DIV DIV OpCode = 0x4
SDIV SDIV OpCode = 0x5
MOD MOD OpCode = 0x6
SMOD SMOD OpCode = 0x7
ADDMOD ADDMOD OpCode = 0x8
MULMOD MULMOD OpCode = 0x9
EXP EXP OpCode = 0xa
SIGNEXTEND SIGNEXTEND OpCode = 0xb
) )
// 0x10 range - comparison ops. // 0x10 range - comparison ops.
const ( const (
LT OpCode = iota + 0x10 LT OpCode = 0x10
GT GT OpCode = 0x11
SLT SLT OpCode = 0x12
SGT SGT OpCode = 0x13
EQ EQ OpCode = 0x14
ISZERO ISZERO OpCode = 0x15
AND AND OpCode = 0x16
OR OR OpCode = 0x17
XOR XOR OpCode = 0x18
NOT NOT OpCode = 0x19
BYTE BYTE OpCode = 0x1a
SHL SHL OpCode = 0x1b
SHR SHR OpCode = 0x1c
SAR SAR OpCode = 0x1d
SHA3 OpCode = 0x20 SHA3 OpCode = 0x20
) )
// 0x30 range - closure state. // 0x30 range - closure state.
const ( const (
ADDRESS OpCode = 0x30 + iota ADDRESS OpCode = 0x30
BALANCE BALANCE OpCode = 0x31
ORIGIN ORIGIN OpCode = 0x32
CALLER CALLER OpCode = 0x33
CALLVALUE CALLVALUE OpCode = 0x34
CALLDATALOAD CALLDATALOAD OpCode = 0x35
CALLDATASIZE CALLDATASIZE OpCode = 0x36
CALLDATACOPY CALLDATACOPY OpCode = 0x37
CODESIZE CODESIZE OpCode = 0x38
CODECOPY CODECOPY OpCode = 0x39
GASPRICE GASPRICE OpCode = 0x3a
EXTCODESIZE EXTCODESIZE OpCode = 0x3b
EXTCODECOPY EXTCODECOPY OpCode = 0x3c
RETURNDATASIZE RETURNDATASIZE OpCode = 0x3d
RETURNDATACOPY RETURNDATACOPY OpCode = 0x3e
EXTCODEHASH EXTCODEHASH OpCode = 0x3f
) )
// 0x40 range - block operations. // 0x40 range - block operations.
const ( const (
BLOCKHASH OpCode = 0x40 + iota BLOCKHASH OpCode = 0x40
COINBASE COINBASE OpCode = 0x41
TIMESTAMP TIMESTAMP OpCode = 0x42
NUMBER NUMBER OpCode = 0x43
DIFFICULTY DIFFICULTY OpCode = 0x44
GASLIMIT GASLIMIT OpCode = 0x45
CHAINID OpCode = 0x46 CHAINID OpCode = 0x46
SELFBALANCE OpCode = 0x47 SELFBALANCE OpCode = 0x47
BASEFEE OpCode = 0x48 BASEFEE OpCode = 0x48
@ -122,7 +122,7 @@ const (
JUMPDEST OpCode = 0x5b JUMPDEST OpCode = 0x5b
) )
// 0x60 range. // 0x60 range - pushes.
const ( const (
PUSH1 OpCode = 0x60 + iota PUSH1 OpCode = 0x60 + iota
PUSH2 PUSH2
@ -156,7 +156,11 @@ const (
PUSH30 PUSH30
PUSH31 PUSH31
PUSH32 PUSH32
DUP1 )
// 0x80 range - dups.
const (
DUP1 = 0x80 + iota
DUP2 DUP2
DUP3 DUP3
DUP4 DUP4
@ -172,7 +176,11 @@ const (
DUP14 DUP14
DUP15 DUP15
DUP16 DUP16
SWAP1 )
// 0x90 range - swaps.
const (
SWAP1 = 0x90 + iota
SWAP2 SWAP2
SWAP3 SWAP3
SWAP4 SWAP4
@ -208,12 +216,13 @@ const (
// 0xf0 range - closures. // 0xf0 range - closures.
const ( const (
CREATE OpCode = 0xf0 + iota CREATE OpCode = 0xf0
CALL CALL OpCode = 0xf1
CALLCODE CALLCODE OpCode = 0xf2
RETURN RETURN OpCode = 0xf3
DELEGATECALL DELEGATECALL OpCode = 0xf4
CREATE2 CREATE2 OpCode = 0xf5
STATICCALL OpCode = 0xfa STATICCALL OpCode = 0xfa
REVERT OpCode = 0xfd REVERT OpCode = 0xfd
SELFDESTRUCT OpCode = 0xff SELFDESTRUCT OpCode = 0xff