Fabcoin Core  0.16.2
P2P Digital Currency
Instruction.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "Common.h"
4 
5 namespace llvm
6 {
7  class APInt;
8 }
9 
10 namespace dev
11 {
12 namespace evmjit
13 {
14 
16 enum class Instruction: uint8_t
17 {
18  STOP = 0x00,
19  ADD,
20  MUL,
21  SUB,
22  DIV,
23  SDIV,
24  MOD,
25  SMOD,
26  ADDMOD,
27  MULMOD,
28  EXP,
29  SIGNEXTEND,
30 
31  LT = 0x10,
32  GT,
33  SLT,
34  SGT,
35  EQ,
36  ISZERO,
37  AND,
38  OR,
39  XOR,
40  NOT,
41  BYTE,
42 
43  SHA3 = 0x20,
44 
45  ADDRESS = 0x30,
46  BALANCE,
47  ORIGIN,
48  CALLER,
49  CALLVALUE,
50  CALLDATALOAD,
51  CALLDATASIZE,
52  CALLDATACOPY,
53  CODESIZE,
54  CODECOPY,
55  GASPRICE,
56  EXTCODESIZE,
57  EXTCODECOPY,
58 
59  BLOCKHASH = 0x40,
60  COINBASE,
61  TIMESTAMP,
62  NUMBER,
63  DIFFICULTY,
64  GASLIMIT,
65 
66  POP = 0x50,
67  MLOAD,
68  MSTORE,
69  MSTORE8,
70  SLOAD,
71  SSTORE,
72  JUMP,
73  JUMPI,
74  PC,
75  MSIZE,
76  GAS,
77  JUMPDEST,
78 
79  PUSH1 = 0x60,
80  PUSH2,
81  PUSH3,
82  PUSH4,
83  PUSH5,
84  PUSH6,
85  PUSH7,
86  PUSH8,
87  PUSH9,
88  PUSH10,
89  PUSH11,
90  PUSH12,
91  PUSH13,
92  PUSH14,
93  PUSH15,
94  PUSH16,
95  PUSH17,
96  PUSH18,
97  PUSH19,
98  PUSH20,
99  PUSH21,
100  PUSH22,
101  PUSH23,
102  PUSH24,
103  PUSH25,
104  PUSH26,
105  PUSH27,
106  PUSH28,
107  PUSH29,
108  PUSH30,
109  PUSH31,
110  PUSH32,
111 
112  DUP1 = 0x80,
113  DUP2,
114  DUP3,
115  DUP4,
116  DUP5,
117  DUP6,
118  DUP7,
119  DUP8,
120  DUP9,
121  DUP10,
122  DUP11,
123  DUP12,
124  DUP13,
125  DUP14,
126  DUP15,
127  DUP16,
128 
129  SWAP1 = 0x90,
130  SWAP2,
131  SWAP3,
132  SWAP4,
133  SWAP5,
134  SWAP6,
135  SWAP7,
136  SWAP8,
137  SWAP9,
138  SWAP10,
139  SWAP11,
140  SWAP12,
141  SWAP13,
142  SWAP14,
143  SWAP15,
144  SWAP16,
145 
146  LOG0 = 0xa0,
147  LOG1,
148  LOG2,
149  LOG3,
150  LOG4,
151 
152  CREATE = 0xf0,
153  CALL,
154  CALLCODE,
155  RETURN,
156  DELEGATECALL,
157  SUICIDE = 0xff
158 };
159 
163 llvm::APInt readPushData(code_iterator& _curr, code_iterator _end);
164 
167 void skipPushData(code_iterator& _curr, code_iterator _end);
168 
169 #define ANY_PUSH PUSH1: \
170  case Instruction::PUSH2: \
171  case Instruction::PUSH3: \
172  case Instruction::PUSH4: \
173  case Instruction::PUSH5: \
174  case Instruction::PUSH6: \
175  case Instruction::PUSH7: \
176  case Instruction::PUSH8: \
177  case Instruction::PUSH9: \
178  case Instruction::PUSH10: \
179  case Instruction::PUSH11: \
180  case Instruction::PUSH12: \
181  case Instruction::PUSH13: \
182  case Instruction::PUSH14: \
183  case Instruction::PUSH15: \
184  case Instruction::PUSH16: \
185  case Instruction::PUSH17: \
186  case Instruction::PUSH18: \
187  case Instruction::PUSH19: \
188  case Instruction::PUSH20: \
189  case Instruction::PUSH21: \
190  case Instruction::PUSH22: \
191  case Instruction::PUSH23: \
192  case Instruction::PUSH24: \
193  case Instruction::PUSH25: \
194  case Instruction::PUSH26: \
195  case Instruction::PUSH27: \
196  case Instruction::PUSH28: \
197  case Instruction::PUSH29: \
198  case Instruction::PUSH30: \
199  case Instruction::PUSH31: \
200  case Instruction::PUSH32
201 
202 #define ANY_DUP DUP1: \
203  case Instruction::DUP2: \
204  case Instruction::DUP3: \
205  case Instruction::DUP4: \
206  case Instruction::DUP5: \
207  case Instruction::DUP6: \
208  case Instruction::DUP7: \
209  case Instruction::DUP8: \
210  case Instruction::DUP9: \
211  case Instruction::DUP10: \
212  case Instruction::DUP11: \
213  case Instruction::DUP12: \
214  case Instruction::DUP13: \
215  case Instruction::DUP14: \
216  case Instruction::DUP15: \
217  case Instruction::DUP16
218 
219 #define ANY_SWAP SWAP1: \
220  case Instruction::SWAP2: \
221  case Instruction::SWAP3: \
222  case Instruction::SWAP4: \
223  case Instruction::SWAP5: \
224  case Instruction::SWAP6: \
225  case Instruction::SWAP7: \
226  case Instruction::SWAP8: \
227  case Instruction::SWAP9: \
228  case Instruction::SWAP10: \
229  case Instruction::SWAP11: \
230  case Instruction::SWAP12: \
231  case Instruction::SWAP13: \
232  case Instruction::SWAP14: \
233  case Instruction::SWAP15: \
234  case Instruction::SWAP16
235 
236 }
237 }
modulo remainder operation
Adapted from code found on http://stackoverflow.com/questions/180947/base64-decode-snippet-in-c Origi...
Definition: Arith256.cpp:15
get hash of most recent complete block
get the block's difficulty
bitwise NOT opertation
get the block's gas limit
Definition: Cache.h:11
get balance of the given account
#define OR
Definition: lubyrack.h:61
place 3 byte item on stack
message-call into an account
copies the 10th highest item in the stack to the top of the stack
Makes a log entry; no topics.
place 17 byte item on stack
copy input data in current environment to memory
bitwise AND operation
swaps the highest and 15th highest value on the stack
#define MUL(a, b)
Definition: idea.cpp:154
SHA3 message digest base class.
Definition: sha3.h:28
equality comparision
swaps the highest and 5th highest value on the stack
halt execution returning output data
place 30 byte item on stack
copies the second highest item in the stack to the top of the stack
swaps the highest and 7th highest value on the stack
copies the 11th highest item in the stack to the top of the stack
get the program counter
place 2 byte item on stack
place 7 byte item on stack
place 22 byte item on stack
swaps the highest and 8th highest value on the stack
place 6 byte item on stack
Makes a log entry; 3 topics.
place 8 byte item on stack
swaps the highest and 17th highest value on the stack
halt execution and register account for later deletion
get the block's number
Instruction
Virtual machine bytecode instruction.
Definition: Instruction.h:16
place 5 byte item on stack
swaps the highest and 6th highest value on the stack
integer division operation
place 11 byte item on stack
copies the 8th highest item in the stack to the top of the stack
load word from memory
get address of currently executing account
copy external code (from another contract)
get the block's coinbase address
place 16 byte item on stack
copies the 5th highest item in the stack to the top of the stack
byte const * code_iterator
Definition: Common.h:11
swaps the highest and 4th highest value on the stack
#define LT(i, a, b, c, d, e)
Definition: serpentp.h:6
retrieve single byte from word
place 21 byte item on stack
subtraction operation
Makes a log entry; 2 topics.
copies the 15th highest item in the stack to the top of the stack
place 13 byte item on stack
get external code size (from another contract)
copies the 6th highest item in the stack to the top of the stack
place 4 byte item on stack
swaps the highest and 13th highest value on the stack
unsigned modular multiplication
bitwise XOR operation
void skipPushData(code_iterator &_curr, code_iterator _end)
Skips PUSH data in pointed fragment of bytecode.
Definition: Instruction.cpp:29
swaps the highest and 9th highest value on the stack
place 9 byte item on stack
extend length of signed integer
place 12 byte item on stack
#define MSIZE
Definition: lockedpool.cpp:14
get execution origination address
place 23 byte item on stack
copies the 14th highest item in the stack to the top of the stack
place 29 byte item on stack
place 26 byte item on stack
create a new account with associated code
place 15 byte item on stack
get deposited value by the instruction/transaction responsible for this execution ...
signed integer division operation
load word from storage
get the block's timestamp
get size of code running in current environment
alter the program counter
place 31 byte item on stack
swaps the highest and second highest value on the stack
place 28 byte item on stack
place 10 byte item on stack
signed less-than comparision
get size of input data in current environment
signed greater-than comparision
copies the highest item in the stack to the top of the stack
get price of gas in current environment
copies the 12th highest item in the stack to the top of the stack
get the amount of available gas
place 19 byte item on stack
place 14 byte item on stack
copies the 9th highest item in the stack to the top of the stack
copies the 7th highest item in the stack to the top of the stack
place 24 byte item on stack
set a potential jump destination
message-call with another account's code only
swaps the highest and 16th highest value on the stack
swaps the highest and 12th highest value on the stack
copies the 4th highest item in the stack to the top of the stack
place 20 byte item on stack
place 25 byte item on stack
place 18 byte item on stack
copy code running in current environment to memory
like CALLCODE but keeps caller's value and sender (only from homestead on)
remove item from stack
copies the 13th highest item in the stack to the top of the stack
conditionally alter the program counter
llvm::APInt readPushData(code_iterator &_curr, code_iterator _end)
Reads PUSH data from pointed fragment of bytecode and constructs number out of it Reading out of byte...
Definition: Instruction.cpp:12
swaps the highest and 11th highest value on the stack
swaps the highest and third highest value on the stack
place 1 byte item on stack
unsigned modular addition
copies the third highest item in the stack to the top of the stack
signed modulo remainder operation
swaps the highest and 10th highest value on the stack
copies the 16th highest item in the stack to the top of the stack
#define EXP(x)
Definition: safer.cpp:50
greater-than comparision
place 32 byte item on stack
place 27 byte item on stack
Makes a log entry; 1 topic.
get input data of current environment
swaps the highest and 14th highest value on the stack
Makes a log entry; 4 topics.