Browse Source

Own cached objects

cl-refactor
Paweł Bylica 10 years ago
parent
commit
8287c6040a
  1. 4
      libevmjit/Cache.cpp
  2. 2
      libevmjit/Cache.h

4
libevmjit/Cache.cpp

@ -56,8 +56,8 @@ ObjectCache* Cache::getObjectCache()
void ObjectCache::notifyObjectCompiled(llvm::Module const* _module, llvm::MemoryBuffer const* _object) void ObjectCache::notifyObjectCompiled(llvm::Module const* _module, llvm::MemoryBuffer const* _object)
{ {
auto&& key = _module->getModuleIdentifier(); auto&& key = _module->getModuleIdentifier();
auto obj = llvm::MemoryBuffer::getMemBufferCopy(_object->getBuffer()); std::unique_ptr<llvm::MemoryBuffer> obj(llvm::MemoryBuffer::getMemBufferCopy(_object->getBuffer()));
m_map.insert(std::make_pair(key, obj)); m_map.insert(std::make_pair(key, std::move(obj)));
} }
llvm::MemoryBuffer* ObjectCache::getObject(llvm::Module const* _module) llvm::MemoryBuffer* ObjectCache::getObject(llvm::Module const* _module)

2
libevmjit/Cache.h

@ -42,7 +42,7 @@ public:
virtual llvm::MemoryBuffer* getObject(llvm::Module const* _module) final override; virtual llvm::MemoryBuffer* getObject(llvm::Module const* _module) final override;
private: private:
std::unordered_map<std::string, llvm::MemoryBuffer*> m_map; std::unordered_map<std::string, std::unique_ptr<llvm::MemoryBuffer>> m_map;
}; };

Loading…
Cancel
Save