| 150 | }; |
| 151 | |
| 152 | void LlvmCodeGenCacheTest::CheckResult( |
| 153 | CodeGenCacheEntry& entry, const string& module_id, bool is_double) { |
| 154 | ASSERT_TRUE(!entry.Empty()); |
| 155 | ASSERT_TRUE(entry.cached_engine_pointer != nullptr); |
| 156 | scoped_ptr<LlvmCodeGen> codegen; |
| 157 | ASSERT_OK( |
| 158 | LlvmCodeGen::CreateImpalaCodegen(fragment_state_, nullptr, "test1", &codegen)); |
| 159 | if (is_double) { |
| 160 | AddLlvmCodegenDouble(codegen.get(), nullptr, false /*doFinalizeModule*/); |
| 161 | } else { |
| 162 | AddLlvmCodegenEcho(codegen.get(), nullptr, false /*doFinalizeModule*/); |
| 163 | } |
| 164 | ASSERT_OK(codegen->FinalizeLazyMaterialization()); |
| 165 | codegen->module_->setModuleIdentifier(module_id); |
| 166 | // Use the specific cache for finalizing the module and expect the compiled functions |
| 167 | // in the execution engine is from the cache, then verify the correctness. |
| 168 | codegen->execution_engine()->setObjectCache(entry.cached_engine_pointer); |
| 169 | codegen->execution_engine()->finalizeObject(); |
| 170 | codegen->DestroyModule(); |
| 171 | CheckResult(codegen.get(), is_double); |
| 172 | codegen->Close(); |
| 173 | } |
| 174 | |
| 175 | // The function is to create and return a CodeGenObjectCache which contains a specific |
| 176 | // compiled codegened function. |
nothing calls this directly
no test coverage detected