MCPcopy Create free account
hub / github.com/apache/impala / notifyObjectCompiled

Method notifyObjectCompiled

be/src/codegen/llvm-codegen-object-cache.cc:27–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25namespace impala {
26
27void CodeGenObjectCache::notifyObjectCompiled(
28 const llvm::Module* M, llvm::MemoryBufferRef ObjBuffer) {
29 DCHECK(M != nullptr);
30 // Save the compiled object in the memory cache, with the module ID as the key.
31 // In our scenario, we anticipate having only one module per execution engine.
32 // Consequently, each CodeGenObjectCache should hold just one module.
33 // If a module with a different ID is encountered, a warning is logged for
34 // further investigation.
35 const string& module_id = M->getModuleIdentifier();
36 std::lock_guard<std::mutex> l(mutex_);
37 if (key_.empty()) {
38 LOG(INFO) << "Insert module id " << module_id << " in CodeGenObjectCache " << this
39 << " with size " << ObjBuffer.getBuffer().size() << " bytes";
40 key_ = module_id;
41 // The Buffer Id doesn't seem to serve a purpose in our case, and skipping it
42 // can conserve memory.
43 cached_obj_ =
44 llvm::MemoryBuffer::getMemBufferCopy(ObjBuffer.getBuffer(), "" /*Buffer Id*/);
45 } else if (key_ != module_id) {
46 stringstream ss;
47 ss << "Inserting a different module in CodeGenObjectCache " << this
48 << ". Old module id is " << module_id << ", and new module id is " << key_;
49 DCHECK(false) << ss.str();
50 LOG(WARNING) << ss.str();
51 }
52}
53
54std::unique_ptr<llvm::MemoryBuffer> CodeGenObjectCache::getObject(const llvm::Module* M) {
55 DCHECK(M != nullptr);

Callers

nothing calls this directly

Calls 3

emptyMethod · 0.45
sizeMethod · 0.45
strMethod · 0.45

Tested by

no test coverage detected