Browse Source

Fix cache mode handling.

cl-refactor
Paweł Bylica 10 years ago
parent
commit
c66a7e49d3
  1. 17
      libevmjit/Cache.cpp
  2. 2
      libevmjit/Cache.h
  3. 6
      libevmjit/ExecutionEngine.cpp

17
libevmjit/Cache.cpp

@ -40,12 +40,23 @@ namespace
}
}
ObjectCache* Cache::getObjectCache(CacheMode _mode, ExecutionEngineListener* _listener)
ObjectCache* Cache::init(CacheMode _mode, ExecutionEngineListener* _listener)
{
static ObjectCache objectCache;
g_mode = _mode;
g_listener = _listener;
return &objectCache;
if (g_mode == CacheMode::clear)
{
Cache::clear();
g_mode = CacheMode::off;
}
if (g_mode != CacheMode::off)
{
static ObjectCache objectCache;
return &objectCache;
}
return nullptr;
}
void Cache::clear()

2
libevmjit/Cache.h

@ -45,7 +45,7 @@ public:
class Cache
{
public:
static ObjectCache* getObjectCache(CacheMode _mode, ExecutionEngineListener* _listener);
static ObjectCache* init(CacheMode _mode, ExecutionEngineListener* _listener);
static std::unique_ptr<llvm::Module> getObject(std::string const& id);
/// Clears cache storage

6
libevmjit/ExecutionEngine.cpp

@ -108,9 +108,6 @@ ExecutionEngine::ExecutionEngine()
parseOptions();
if (g_cache == CacheMode::clear)
Cache::clear();
bool preloadCache = g_cache == CacheMode::preload;
if (preloadCache)
g_cache = CacheMode::on;
@ -133,8 +130,7 @@ ExecutionEngine::ExecutionEngine()
g_ee = (builder.create());
// TODO: Update cache listener
auto objectCache = (g_cache != CacheMode::off && g_cache != CacheMode::clear) ? Cache::getObjectCache(g_cache, nullptr) : nullptr;
g_ee->setObjectCache(objectCache);
g_ee->setObjectCache(Cache::init(g_cache, nullptr));
// FIXME: Disabled during API changes
//if (preloadCache)

Loading…
Cancel
Save