37 void validateSubroutine(uint64_t _PC, uint64_t* _rp,
u256* _sp);
50 uint64_t m_io_gas = 0;
54 static std::array<InstructionMetric, 256> c_metrics;
55 static void initMetrics();
58 typedef void (
LegacyVM::*MemFnPtr)();
59 MemFnPtr m_bounce = 0;
60 MemFnPtr m_onFail = 0;
61 uint64_t m_nSteps = 0;
78 u256 *m_stackEnd = &m_stack[1024];
79 size_t stackSize() {
return m_stackEnd - m_SP; }
83 uint64_t m_return[1024];
86 std::vector<size_t> m_frameSize;
90 std::vector<u256> m_pool;
95 u256* m_SP = m_stackEnd;
98 uint64_t* m_RP = m_return - 1;
102 uint64_t m_runGas = 0;
103 uint64_t m_newMemSize = 0;
104 uint64_t m_copyMemSize = 0;
111 void interpretCases();
115 bool caseCallSetup(CallParameters*,
bytesRef& o_output);
119 uint64_t memNeed(
u256 const& _offset,
u256 const& _size);
121 void throwOutOfGas();
122 void throwBadInstruction();
123 void throwBadJumpDestination();
124 void throwBadStack(
unsigned _removed,
unsigned _added);
125 void throwRevertInstruction(owning_bytes_ref&& _output);
126 void throwDisallowedStateChange();
127 void throwBufferOverrun(
bigint const& _enfOfAccess);
129 std::vector<uint64_t> m_beginSubs;
130 std::vector<uint64_t> m_jumpDests;
131 int64_t verifyJumpDest(
u256 const& _dest,
bool _throw =
true);
134 void adjustStack(
unsigned _removed,
unsigned _added);
135 uint64_t gasForMem(
u512 const& _size);
137 void updateSSGasPreEIP1283(
u256 const& _currentValue,
u256 const& _newValue);
138 void updateSSGasEIP1283(
u256 const& _currentValue,
u256 const& _newValue);
141 void updateMem(uint64_t _newMem);
143 void fetchInstruction();
145 uint64_t decodeJumpDest(
const byte*
const _code, uint64_t& _pc);
146 uint64_t decodeJumpvDest(
const byte*
const _code, uint64_t& _pc,
byte _voff);
148 template<
class T> uint64_t toInt63(T v)
151 if (v > 0x7FFFFFFFFFFFFFFF)
153 uint64_t w = uint64_t(v);
157 template<
class T> uint64_t toInt15(T v)
162 uint64_t w = uint64_t(v);
177 void xsdiv (uint8_t);
179 void xsmod (uint8_t);
185 void xzero (uint8_t);
195 void xmload (uint8_t);
196 void xmstore (uint8_t);
197 void xsload (uint8_t);
198 void xsstore (uint8_t);
199 void xvtowide(uint8_t);
200 void xwidetov(uint8_t);
201 void xpush (uint8_t);
202 void xput (uint8_t, uint8_t);
203 void xget (uint8_t, uint8_t);
204 void xswizzle(uint8_t);
205 void xshuffle(uint8_t);
207 u256 vtow(uint8_t _b,
const u256& _in);
208 void wtov(uint8_t _b,
u256 _in,
u256& _o_out);
212 uint8_t nt = m_code[++m_PC];