|
|
@ -83,29 +83,9 @@ inline bytesConstRef VM::go(ExtVMFace& _ext, OnOpFunc const& _onOp, uint64_t _st |
|
|
|
auto memNeed = [](dev::u256 _offset, dev::u256 _size) { return _size ? (bigint)_offset + _size : (bigint)0; }; |
|
|
|
|
|
|
|
if (m_jumpDests.empty()) |
|
|
|
{ |
|
|
|
std::set<u256> implicit; |
|
|
|
for (unsigned i = 0; i < _ext.code.size(); ++i) |
|
|
|
if (_ext.code[i] == (byte)Instruction::JUMPDEST) |
|
|
|
m_jumpDests.insert(i); |
|
|
|
else if (_ext.code[i] >= (byte)Instruction::PUSH1 && _ext.code[i] <= (byte)Instruction::PUSH32) |
|
|
|
{ |
|
|
|
int in = _ext.code[i] - (unsigned)Instruction::PUSH1 + 1; |
|
|
|
u256 p = 0; |
|
|
|
for (i++; in--; i++) |
|
|
|
p = (p << 8) | _ext.getCode(i); |
|
|
|
if ((_ext.getCode(i) == (byte)Instruction::JUMP || _ext.getCode(i) == (byte)Instruction::JUMPI) && !(_ext.getCode(p) == (byte)Instruction::JUMP || _ext.getCode(p) == (byte)Instruction::JUMPI)) |
|
|
|
if (p >= _ext.code.size()) |
|
|
|
m_jumpDests.insert(p); |
|
|
|
else |
|
|
|
implicit.insert(p); |
|
|
|
else {} |
|
|
|
i--; |
|
|
|
} |
|
|
|
for (unsigned i = 0; i < _ext.code.size(); i += instructionInfo((Instruction)_ext.getCode(i)).additional + 1) |
|
|
|
if (implicit.count(i)) |
|
|
|
m_jumpDests.insert(i); |
|
|
|
} |
|
|
|
|
|
|
|
u256 nextPC = m_curPC + 1; |
|
|
|
auto osteps = _steps; |
|
|
|