From 0c03100b8b62cb80ab506c14858d089881aa9ddd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Wed, 25 Feb 2015 11:44:06 +0100 Subject: [PATCH] Correct and tested EVM JIT to Interpreter fallback in case of high gas limit --- evmjit/libevmjit-cpp/JitVM.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/evmjit/libevmjit-cpp/JitVM.cpp b/evmjit/libevmjit-cpp/JitVM.cpp index 55dcd94f8..e28fcd39f 100644 --- a/evmjit/libevmjit-cpp/JitVM.cpp +++ b/evmjit/libevmjit-cpp/JitVM.cpp @@ -1,10 +1,14 @@ #pragma GCC diagnostic ignored "-Wconversion" + #include "JitVM.h" + +#include +#include #include #include -#include #include + #include "Utils.h" namespace dev @@ -27,12 +31,13 @@ bytesConstRef JitVM::go(ExtVMFace& _ext, OnOpFunc const& _onOp, uint64_t _step) if (rejected) { - UNTESTED; - std::cerr << "Rejected\n"; + cwarn << "Execution rejected by EVM JIT (gas limit: " << m_gas << "), executing with interpreter"; VMFactory::setKind(VMKind::Interpreter); m_fallbackVM = VMFactory::create(m_gas); VMFactory::setKind(VMKind::JIT); - return m_fallbackVM->go(_ext, _onOp, _step); + auto&& output = m_fallbackVM->go(_ext, _onOp, _step); + m_gas = m_fallbackVM->gas(); // copy remaining gas, Executive expects it + return output; } m_data.gas = static_cast(m_gas);