24 #include <unordered_map> 65 #if EVM_JUMPS_AND_SUBS 68 void validateSubroutine(uint64_t _PC, uint64_t* _RP,
u256* _SP);
77 uint64_t m_io_gas = 0;
81 static std::array<InstructionMetric, 256>
c_metrics;
82 static void initMetrics();
85 const void*
const* c_jumpTable = 0;
86 bool m_caseInit =
false;
88 typedef void (
VM::*MemFnPtr)();
89 MemFnPtr m_bounce = 0;
90 MemFnPtr m_onFail = 0;
91 uint64_t m_nSteps = 0;
106 u256* m_stack = m_stackSpace + 1;
109 #if EVM_JUMPS_AND_SUBS 111 uint64_t m_returnSpace[1025];
112 uint64_t* m_return = m_returnSpace + 1;
115 std::vector<size_t> m_frameSize;
125 #if EVM_JUMPS_AND_SUBS 126 uint64_t* m_RP = m_return - 1;
130 uint64_t m_runGas = 0;
131 uint64_t m_newMemSize = 0;
132 uint64_t m_copyMemSize = 0;
139 void interpretCases();
147 uint64_t memNeed(
u256 _offset,
u256 _size);
149 void throwOutOfGas();
150 void throwBadInstruction();
151 void throwBadJumpDestination();
152 void throwBadStack(
unsigned _size,
unsigned _n,
unsigned _d);
154 void reportStackUse();
158 int64_t verifyJumpDest(
u256 const& _dest,
bool _throw =
true);
160 int poolConstant(
const u256&);
163 void checkStack(
unsigned _n,
unsigned _d);
164 uint64_t gasForMem(
u512 _size);
169 void fetchInstruction();
171 uint64_t decodeJumpDest(
const byte*
const _code, uint64_t& _pc);
172 uint64_t decodeJumpvDest(
const byte*
const _code, uint64_t& _pc,
u256*& _sp);
177 if (v > 0x7FFFFFFFFFFFFFFF)
179 uint64_t w = uint64_t(v);
Adapted from code found on http://stackoverflow.com/questions/180947/base64-decode-snippet-in-c Origi...
A modifiable reference to an existing object or vector in memory.
h160 right160(h256 const &_t)
Convert the given value into h160 (160-bit unsigned integer) using the right 20 bytes.
std::vector< uint64_t > m_jumpDests
static std::array< InstructionMetric, 256 > c_metrics
assert(len-trim+(2 *lenIndices)<=WIDTH)
u256 fromAddress(Address _a)
boost::multiprecision::number< boost::multiprecision::cpp_int_backend< 160, 160, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void >> u160
owning_bytes_ref m_output
std::vector< u256 > u256s
std::vector< byte > bytes
bytes const & memory() const
Fixed-size raw-byte array container type, with an API optimised for storing hashes.
boost::multiprecision::number< boost::multiprecision::cpp_int_backend< 512, 512, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void >> u512
std::function< void(uint64_t, uint64_t, Instruction, bigint, bigint, bigint, VM *, ExtVMFace const *)> OnOpFunc
boost::multiprecision::number< boost::multiprecision::cpp_int_backend< 256, 256, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void >> u256
EVM Virtual Machine interface.
Instruction
Virtual machine bytecode instruction.
Interface and null implementation of the class for specifying VM externalities.
Reference to a slice of buffer that also owns the buffer.
Address asAddress(u256 _item)
bool optimize(llvm::Module &_module)
std::vector< uint64_t > m_beginSubs