Helper function to store a specific key to the global codegen cache.
| 631 | |
| 632 | /// Helper function to store a specific key to the global codegen cache. |
| 633 | void LlvmCodeGenCacheTest::StoreHelper(TCodeGenCacheMode::type mode, string key) { |
| 634 | // Create a LlvmCodeGen containing a codegen function Echo. |
| 635 | scoped_ptr<LlvmCodeGen> codegen; |
| 636 | ASSERT_OK(LlvmCodeGen::CreateImpalaCodegen(fragment_state_, nullptr, "test", &codegen)); |
| 637 | shared_ptr<CodeGenObjectCache> engine_cache = |
| 638 | CreateObjCache(true /*is_double*/, nullptr /*module_id*/); |
| 639 | codegen->engine_cache_ = engine_cache; |
| 640 | CodeGenCacheKey cache_key; |
| 641 | CodeGenCacheEntry entry; |
| 642 | CodeGenCacheKeyConstructor::construct(key, &cache_key); |
| 643 | EXPECT_OK(codegen_cache_->Store(cache_key, codegen.get(), mode, opt_level_)); |
| 644 | CheckObjCacheExists(codegen.get()); |
| 645 | codegen->Close(); |
| 646 | } |
| 647 | |
| 648 | /// Concurrently store random entries to the global codegen cache, and check if all |
| 649 | /// the resources alright. |