|
|
@ -54,16 +54,14 @@ class VM: public VMFace |
|
|
|
public: |
|
|
|
virtual bytesConstRef go(u256& io_gas, ExtVMFace& _ext, OnOpFunc const& _onOp = {}, uint64_t _steps = (uint64_t)-1) override final; |
|
|
|
|
|
|
|
void require(u256 _n, u256 _d) { if (m_stack.size() < _n) { if (m_onFail) m_onFail(); BOOST_THROW_EXCEPTION(StackUnderflow() << RequirementError((bigint)_n, (bigint)m_stack.size())); } if (m_stack.size() - _n + _d > c_stackLimit) { if (m_onFail) m_onFail(); BOOST_THROW_EXCEPTION(OutOfStack() << RequirementError((bigint)(_d - _n), (bigint)m_stack.size())); } } |
|
|
|
void requireMem(unsigned _n) { if (m_temp.size() < _n) { m_temp.resize(_n); } } |
|
|
|
|
|
|
|
u256 curPC() const { return m_curPC; } |
|
|
|
|
|
|
|
bytes const& memory() const { return m_temp; } |
|
|
|
u256s const& stack() const { return m_stack; } |
|
|
|
|
|
|
|
private: |
|
|
|
friend class VMFactory; |
|
|
|
void require(u256 _n, u256 _d) { if (m_stack.size() < _n) { if (m_onFail) m_onFail(); BOOST_THROW_EXCEPTION(StackUnderflow() << RequirementError((bigint)_n, (bigint)m_stack.size())); } if (m_stack.size() - _n + _d > c_stackLimit) { if (m_onFail) m_onFail(); BOOST_THROW_EXCEPTION(OutOfStack() << RequirementError((bigint)(_d - _n), (bigint)m_stack.size())); } } |
|
|
|
void requireMem(unsigned _n) { if (m_temp.size() < _n) { m_temp.resize(_n); } } |
|
|
|
|
|
|
|
u256 m_curPC = 0; |
|
|
|
bytes m_temp; |
|
|
|