Browse Source

Environment options for EVM JIT updated:

- EVMJIT_CACHE=0 disables disk cache, default 1
- EVMJIT_DUMP=1 dumps LLVM module to error output, default 0
cl-refactor
Paweł Bylica 10 years ago
parent
commit
c49f78ca4f
  1. 20
      evmjit/libevmjit/ExecutionEngine.cpp

20
evmjit/libevmjit/ExecutionEngine.cpp

@ -1,6 +1,7 @@
#include "ExecutionEngine.h"
#include <chrono>
#include <cstdlib> // env options
#include <llvm/IR/Module.h>
#include <llvm/ADT/Triple.h>
@ -19,13 +20,6 @@
#include "Compiler.h"
#include "Cache.h"
#if defined(NDEBUG)
#define DEBUG_ENV_OPTION(name) false
#else
#include <cstdlib>
#define DEBUG_ENV_OPTION(name) (std::getenv(#name) != nullptr)
#endif
namespace dev
{
namespace eth
@ -67,13 +61,21 @@ std::string codeHash(code_iterator _begin, code_iterator _end)
return std::to_string(hash);
}
bool getEnvOption(char const* _name, bool _default)
{
auto var = std::getenv(_name);
if (!var)
return _default;
return std::strtol(var, nullptr, 10) != 0;
}
}
ReturnCode ExecutionEngine::run(RuntimeData* _data, Env* _env)
{
static std::unique_ptr<llvm::ExecutionEngine> ee; // TODO: Use Managed Objects from LLVM?
static auto debugDumpModule = DEBUG_ENV_OPTION(EVMJIT_DUMP_MODULE);
static bool objectCacheEnabled = !DEBUG_ENV_OPTION(EVMJIT_CACHE_OFF);
static auto debugDumpModule = getEnvOption("EVMJIT_DUMP", false);
static auto objectCacheEnabled = getEnvOption("EVMJIT_CACHE", true);
auto codeBegin = _data->code;
auto codeEnd = codeBegin + _data->codeSize;

Loading…
Cancel
Save