@@ -14,159 +14,157 @@ extern "C" {
1414#endif
1515
1616/**
17- * The list of EVM 1 instructions from every EVM revision.
17+ * The list of EVM 1 opcodes from every EVM revision.
1818 */
19- enum evmc_instruction
19+ enum evmc_opcode
2020{
21- STOP = 0x00 ,
22- ADD ,
23- MUL ,
24- SUB ,
25- DIV ,
26- SDIV ,
27- MOD ,
28- SMOD ,
29- ADDMOD ,
30- MULMOD ,
31- EXP ,
32- SIGNEXTEND ,
33-
34- LT = 0x10 ,
35- GT ,
36- SLT ,
37- SGT ,
38- EQ ,
39- ISZERO ,
40- AND ,
41- OR ,
42- XOR ,
43- NOT ,
44- BYTE ,
45- SHL ,
46- SHR ,
47- SAR ,
48-
49- SHA3 = 0x20 ,
50-
51- ADDRESS = 0x30 ,
52- BALANCE ,
53- ORIGIN ,
54- CALLER ,
55- CALLVALUE ,
56- CALLDATALOAD ,
57- CALLDATASIZE ,
58- CALLDATACOPY ,
59- CODESIZE ,
60- CODECOPY ,
61- GASPRICE ,
62- EXTCODESIZE ,
63- EXTCODECOPY ,
64- RETURNDATASIZE = 0x3d ,
65- RETURNDATACOPY = 0x3e ,
66-
67- BLOCKHASH = 0x40 ,
68- COINBASE ,
69- TIMESTAMP ,
70- NUMBER ,
71- DIFFICULTY ,
72- GASLIMIT ,
73-
74- POP = 0x50 ,
75- MLOAD ,
76- MSTORE ,
77- MSTORE8 ,
78- SLOAD ,
79- SSTORE ,
80- JUMP ,
81- JUMPI ,
82- PC ,
83- MSIZE ,
84- GAS ,
85- JUMPDEST ,
86-
87- PUSH1 = 0x60 ,
88- PUSH2 ,
89- PUSH3 ,
90- PUSH4 ,
91- PUSH5 ,
92- PUSH6 ,
93- PUSH7 ,
94- PUSH8 ,
95- PUSH9 ,
96- PUSH10 ,
97- PUSH11 ,
98- PUSH12 ,
99- PUSH13 ,
100- PUSH14 ,
101- PUSH15 ,
102- PUSH16 ,
103- PUSH17 ,
104- PUSH18 ,
105- PUSH19 ,
106- PUSH20 ,
107- PUSH21 ,
108- PUSH22 ,
109- PUSH23 ,
110- PUSH24 ,
111- PUSH25 ,
112- PUSH26 ,
113- PUSH27 ,
114- PUSH28 ,
115- PUSH29 ,
116- PUSH30 ,
117- PUSH31 ,
118- PUSH32 ,
119-
120- DUP1 = 0x80 ,
121- DUP2 ,
122- DUP3 ,
123- DUP4 ,
124- DUP5 ,
125- DUP6 ,
126- DUP7 ,
127- DUP8 ,
128- DUP9 ,
129- DUP10 ,
130- DUP11 ,
131- DUP12 ,
132- DUP13 ,
133- DUP14 ,
134- DUP15 ,
135- DUP16 ,
136-
137- SWAP1 = 0x90 ,
138- SWAP2 ,
139- SWAP3 ,
140- SWAP4 ,
141- SWAP5 ,
142- SWAP6 ,
143- SWAP7 ,
144- SWAP8 ,
145- SWAP9 ,
146- SWAP10 ,
147- SWAP11 ,
148- SWAP12 ,
149- SWAP13 ,
150- SWAP14 ,
151- SWAP15 ,
152- SWAP16 ,
153-
154- LOG0 = 0xa0 ,
155- LOG1 ,
156- LOG2 ,
157- LOG3 ,
158- LOG4 ,
159-
160- CREATE = 0xf0 ,
161- CALL ,
162- CALLCODE ,
163- RETURN ,
164- DELEGATECALL ,
165- STATICCALL = 0xfa ,
166-
167- REVERT = 0xfd ,
168- INVALID = 0xfe ,
169- SELFDESTRUCT = 0xff ,
21+ OP_STOP = 0x00 ,
22+ OP_ADD = 0x01 ,
23+ OP_MUL = 0x02 ,
24+ OP_SUB = 0x03 ,
25+ OP_DIV = 0x04 ,
26+ OP_SDIV = 0x05 ,
27+ OP_MOD = 0x06 ,
28+ OP_SMOD = 0x07 ,
29+ OP_ADDMOD = 0x08 ,
30+ OP_MULMOD = 0x09 ,
31+ OP_EXP = 0x0a ,
32+ OP_SIGNEXTEND = 0x0b ,
33+
34+ OP_LT = 0x10 ,
35+ OP_GT = 0x11 ,
36+ OP_SLT = 0x12 ,
37+ OP_SGT = 0x13 ,
38+ OP_EQ = 0x14 ,
39+ OP_ISZERO = 0x15 ,
40+ OP_AND = 0x16 ,
41+ OP_OR = 0x17 ,
42+ OP_XOR = 0x18 ,
43+ OP_NOT = 0x19 ,
44+ OP_BYTE = 0x1a ,
45+ OP_SHL = 0x1b ,
46+ OP_SHR = 0x1c ,
47+ OP_SAR = 0x1d ,
48+
49+ OP_SHA3 = 0x20 ,
50+
51+ OP_ADDRESS = 0x30 ,
52+ OP_BALANCE = 0x31 ,
53+ OP_ORIGIN = 0x32 ,
54+ OP_CALLER = 0x33 ,
55+ OP_CALLVALUE = 0x34 ,
56+ OP_CALLDATALOAD = 0x35 ,
57+ OP_CALLDATASIZE = 0x36 ,
58+ OP_CALLDATACOPY = 0x37 ,
59+ OP_CODESIZE = 0x38 ,
60+ OP_CODECOPY = 0x39 ,
61+ OP_GASPRICE = 0x3a ,
62+ OP_EXTCODESIZE = 0x3b ,
63+ OP_EXTCODECOPY = 0x3c ,
64+ OP_RETURNDATASIZE = 0x3d ,
65+ OP_RETURNDATACOPY = 0x3e ,
66+
67+ OP_BLOCKHASH = 0x40 ,
68+ OP_COINBASE = 0x41 ,
69+ OP_TIMESTAMP = 0x42 ,
70+ OP_NUMBER = 0x43 ,
71+ OP_DIFFICULTY = 0x44 ,
72+ OP_GASLIMIT = 0x45 ,
73+
74+ OP_POP = 0x50 ,
75+ OP_MLOAD = 0x51 ,
76+ OP_MSTORE = 0x52 ,
77+ OP_MSTORE8 = 0x53 ,
78+ OP_SLOAD = 0x54 ,
79+ OP_SSTORE = 0x55 ,
80+ OP_JUMP = 0x56 ,
81+ OP_JUMPI = 0x57 ,
82+ OP_PC = 0x58 ,
83+ OP_MSIZE = 0x59 ,
84+ OP_GAS = 0x5a ,
85+ OP_JUMPDEST = 0x5b ,
86+
87+ OP_PUSH1 = 0x60 ,
88+ OP_PUSH2 = 0x61 ,
89+ OP_PUSH3 = 0x62 ,
90+ OP_PUSH4 = 0x63 ,
91+ OP_PUSH5 = 0x64 ,
92+ OP_PUSH6 = 0x65 ,
93+ OP_PUSH7 = 0x66 ,
94+ OP_PUSH8 = 0x67 ,
95+ OP_PUSH9 = 0x68 ,
96+ OP_PUSH10 = 0x69 ,
97+ OP_PUSH11 = 0x6a ,
98+ OP_PUSH12 = 0x6b ,
99+ OP_PUSH13 = 0x6c ,
100+ OP_PUSH14 = 0x6d ,
101+ OP_PUSH15 = 0x6e ,
102+ OP_PUSH16 = 0x6f ,
103+ OP_PUSH17 = 0x70 ,
104+ OP_PUSH18 = 0x71 ,
105+ OP_PUSH19 = 0x72 ,
106+ OP_PUSH20 = 0x73 ,
107+ OP_PUSH21 = 0x74 ,
108+ OP_PUSH22 = 0x75 ,
109+ OP_PUSH23 = 0x76 ,
110+ OP_PUSH24 = 0x77 ,
111+ OP_PUSH25 = 0x78 ,
112+ OP_PUSH26 = 0x79 ,
113+ OP_PUSH27 = 0x7a ,
114+ OP_PUSH28 = 0x7b ,
115+ OP_PUSH29 = 0x7c ,
116+ OP_PUSH30 = 0x7d ,
117+ OP_PUSH31 = 0x7e ,
118+ OP_PUSH32 = 0x7f ,
119+ OP_DUP1 = 0x80 ,
120+ OP_DUP2 = 0x81 ,
121+ OP_DUP3 = 0x82 ,
122+ OP_DUP4 = 0x83 ,
123+ OP_DUP5 = 0x84 ,
124+ OP_DUP6 = 0x85 ,
125+ OP_DUP7 = 0x86 ,
126+ OP_DUP8 = 0x87 ,
127+ OP_DUP9 = 0x88 ,
128+ OP_DUP10 = 0x89 ,
129+ OP_DUP11 = 0x8a ,
130+ OP_DUP12 = 0x8b ,
131+ OP_DUP13 = 0x8c ,
132+ OP_DUP14 = 0x8d ,
133+ OP_DUP15 = 0x8e ,
134+ OP_DUP16 = 0x8f ,
135+ OP_SWAP1 = 0x90 ,
136+ OP_SWAP2 = 0x91 ,
137+ OP_SWAP3 = 0x92 ,
138+ OP_SWAP4 = 0x93 ,
139+ OP_SWAP5 = 0x94 ,
140+ OP_SWAP6 = 0x95 ,
141+ OP_SWAP7 = 0x96 ,
142+ OP_SWAP8 = 0x97 ,
143+ OP_SWAP9 = 0x98 ,
144+ OP_SWAP10 = 0x99 ,
145+ OP_SWAP11 = 0x9a ,
146+ OP_SWAP12 = 0x9b ,
147+ OP_SWAP13 = 0x9c ,
148+ OP_SWAP14 = 0x9d ,
149+ OP_SWAP15 = 0x9e ,
150+ OP_SWAP16 = 0x9f ,
151+ OP_LOG0 = 0xa0 ,
152+ OP_LOG1 = 0xa1 ,
153+ OP_LOG2 = 0xa2 ,
154+ OP_LOG3 = 0xa3 ,
155+ OP_LOG4 = 0xa4 ,
156+
157+ OP_CREATE = 0xf0 ,
158+ OP_CALL = 0xf1 ,
159+ OP_CALLCODE = 0xf2 ,
160+ OP_RETURN = 0xf3 ,
161+ OP_DELEGATECALL = 0xf4 ,
162+
163+ OP_STATICCALL = 0xfa ,
164+
165+ OP_REVERT = 0xfd ,
166+ OP_INVALID = 0xfe ,
167+ OP_SELFDESTRUCT = 0xff ,
170168};
171169
172170/**
@@ -176,7 +174,7 @@ enum evmc_instruction
176174 */
177175struct evmc_instruction_metrics
178176{
179- /** The instruction gas cost. Value -1 indicates undefined instruction. */
177+ /** The instruction gas cost. Value -1 indicates an undefined instruction. */
180178 int16_t gas_cost ;
181179
182180 /** The number of items the instruction pops from the EVM stack before execution. */
@@ -190,23 +188,22 @@ struct evmc_instruction_metrics
190188 * Get the table of the EVM 1 instructions metrics.
191189 *
192190 * @param revision The EVM revision.
193- * @return The pointer to the array of 256 instruction metrics.
191+ * @return The pointer to the array of 256 instruction metrics. Null pointer in case
192+ * an invalid EVM revision provided.
194193 */
195194const struct evmc_instruction_metrics * evmc_get_instruction_metrics_table (
196195 enum evmc_revision revision );
197196
198197/**
199198 * Get the table of the EVM 1 instruction names.
200199 *
201- * This table is EVM revision independent and contains the superset of the names of the instructions
202- * from all EVM revisions. Use evmc_get_instruction_metrics_table() to know if an instruction
203- * is present in the given EVM revision.
204- *
205200 * The entries for undefined instructions contain null pointers.
206201 *
207- * @return The pointer to the array of 256 instruction names.
202+ * @param revision The EVM revision.
203+ * @return The pointer to the array of 256 instruction names. Null pointer in case
204+ * an invalid EVM revision provided.
208205 */
209- const char * const * evmc_get_instruction_name_table ( );
206+ const char * const * evmc_get_instruction_names_table ( enum evmc_revision revision );
210207
211208#if __cplusplus
212209 }
0 commit comments