Browse Source

Correct and tested EVM JIT to Interpreter fallback in case of high gas limit

cl-refactor
Paweł Bylica 10 years ago
parent
commit
0c03100b8b
  1. 13
      evmjit/libevmjit-cpp/JitVM.cpp

13
evmjit/libevmjit-cpp/JitVM.cpp

@ -1,10 +1,14 @@
#pragma GCC diagnostic ignored "-Wconversion"
#include "JitVM.h"
#include <libdevcore/Log.h>
#include <libdevcrypto/SHA3.h>
#include <libevm/VM.h>
#include <libevm/VMFactory.h>
#include <libdevcrypto/SHA3.h>
#include <evmjit/libevmjit/ExecutionEngine.h>
#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<decltype(m_data.gas)>(m_gas);

Loading…
Cancel
Save