|
|
@ -74,13 +74,11 @@ extern "C" |
|
|
|
|
|
|
|
using namespace dev::eth::jit; |
|
|
|
|
|
|
|
extern std::jmp_buf* rt_jmpBuf; |
|
|
|
|
|
|
|
EXPORT void stack_pop(Runtime* _rt, uint64_t _count) |
|
|
|
{ |
|
|
|
auto& stack = _rt->getStack(); |
|
|
|
if (stack.size() < _count) |
|
|
|
longjmp(*rt_jmpBuf, static_cast<uint64_t>(ReturnCode::StackTooSmall)); |
|
|
|
longjmp(_rt->getJmpBuf(), static_cast<uint64_t>(ReturnCode::StackTooSmall)); |
|
|
|
|
|
|
|
stack.erase(stack.end() - _count, stack.end()); |
|
|
|
} |
|
|
@ -99,7 +97,7 @@ EXPORT void stack_get(Runtime* _rt, uint64_t _index, i256* _ret) |
|
|
|
auto& stack = _rt->getStack(); |
|
|
|
// TODO: encode _index and stack size in the return code
|
|
|
|
if (stack.size() <= _index) |
|
|
|
longjmp(*rt_jmpBuf, static_cast<uint64_t>(ReturnCode::StackTooSmall)); |
|
|
|
longjmp(_rt->getJmpBuf(), static_cast<uint64_t>(ReturnCode::StackTooSmall)); |
|
|
|
|
|
|
|
*_ret = *(stack.rbegin() + _index); |
|
|
|
} |
|
|
@ -109,7 +107,7 @@ EXPORT void stack_set(Runtime* _rt, uint64_t _index, i256* _word) |
|
|
|
auto& stack = _rt->getStack(); |
|
|
|
// TODO: encode _index and stack size in the return code
|
|
|
|
if (stack.size() <= _index) |
|
|
|
longjmp(*rt_jmpBuf, static_cast<uint64_t>(ReturnCode::StackTooSmall)); |
|
|
|
longjmp(_rt->getJmpBuf(), static_cast<uint64_t>(ReturnCode::StackTooSmall)); |
|
|
|
|
|
|
|
*(stack.rbegin() + _index) = *_word; |
|
|
|
} |
|
|
|