|
|
@ -67,7 +67,14 @@ void printVersion() |
|
|
|
|
|
|
|
namespace cl = llvm::cl; |
|
|
|
cl::opt<bool> g_optimize{"O", cl::desc{"Optimize"}}; |
|
|
|
cl::opt<bool> g_cache{"cache", cl::desc{"Cache compiled EVM code on disk"}, cl::init(true)}; |
|
|
|
cl::opt<CacheMode> g_cache{"cache", cl::desc{"Cache compiled EVM code on disk"}, |
|
|
|
cl::values( |
|
|
|
clEnumValN(CacheMode::on, "1", "Enabled"), |
|
|
|
clEnumValN(CacheMode::off, "0", "Disabled"), |
|
|
|
clEnumValN(CacheMode::read, "r", "Read only. No new objects are added to cache."), |
|
|
|
clEnumValN(CacheMode::write, "w", "Write only. No objects are loaded from cache."), |
|
|
|
clEnumValN(CacheMode::clear, "c", "Clear the cache storage. Cache is disabled."), |
|
|
|
clEnumValEnd)}; |
|
|
|
cl::opt<bool> g_stats{"st", cl::desc{"Statistics"}}; |
|
|
|
cl::opt<bool> g_dump{"dump", cl::desc{"Dump LLVM IR module"}}; |
|
|
|
|
|
|
@ -89,11 +96,14 @@ ReturnCode ExecutionEngine::run(RuntimeData* _data, Env* _env) |
|
|
|
std::unique_ptr<ExecStats> listener{new ExecStats}; |
|
|
|
listener->stateChanged(ExecState::Started); |
|
|
|
|
|
|
|
auto objectCache = g_cache ? Cache::getObjectCache(listener.get()) : nullptr; |
|
|
|
auto objectCache = (g_cache != CacheMode::off && g_cache != CacheMode::clear) ? Cache::getObjectCache(g_cache, listener.get()) : nullptr; |
|
|
|
|
|
|
|
static std::unique_ptr<llvm::ExecutionEngine> ee; |
|
|
|
if (!ee) |
|
|
|
{ |
|
|
|
if (g_cache == CacheMode::clear) |
|
|
|
Cache::clear(); |
|
|
|
|
|
|
|
llvm::InitializeNativeTarget(); |
|
|
|
llvm::InitializeNativeTargetAsmPrinter(); |
|
|
|
|
|
|
|