< prev index next >

src/hotspot/share/c1/c1_Compiler.cpp

Print this page
*** 28,10 ***
--- 28,11 ---
  #include "c1/c1_GraphBuilder.hpp"
  #include "c1/c1_LinearScan.hpp"
  #include "c1/c1_MacroAssembler.hpp"
  #include "c1/c1_Runtime1.hpp"
  #include "c1/c1_ValueType.hpp"
+ #include "code/aotCodeCache.hpp"
  #include "compiler/compileBroker.hpp"
  #include "compiler/compilerDirectives.hpp"
  #include "interpreter/linkResolver.hpp"
  #include "jfr/support/jfrIntrinsics.hpp"
  #include "memory/allocation.hpp"

*** 51,10 ***
--- 52,11 ---
    BufferBlob* buffer_blob = CompilerThread::current()->get_buffer_blob();
    FrameMap::initialize();
    if (!Runtime1::initialize(buffer_blob)) {
      return false;
    }
+   AOTCodeCache::init_c1_table();
    // initialize data structures
    ValueType::initialize();
    GraphBuilder::initialize();
    // note: to use more than one instance of LinearScan at a time this function call has to
    //       be moved somewhere outside of this constructor:

*** 249,10 ***
--- 251,27 ---
  
    return true;
  }
  
  void Compiler::compile_method(ciEnv* env, ciMethod* method, int entry_bci, bool install_code, DirectiveSet* directive) {
+   CompileTask* task = env->task();
+   if (install_code && task->is_aot()) {
+     assert(!task->preload(), "Pre-loading cached code is not implemeted for C1 code");
+     bool success = AOTCodeCache::load_nmethod(env, method, entry_bci, this, CompLevel(task->comp_level()));
+     if (success) {
+       assert(task->is_success(), "sanity");
+       return;
+     }
+     AOTCodeCache::invalidate(task->aot_code_entry()); // mark aot_code_entry as not entrant
+     if (AOTCodeCache::is_code_load_thread_on() && !StoreCachedCode) {
+       // Bail out if failed to load AOT code in AOT Code Caching thread
+       // unless the code is updating.
+       env->record_failure("Failed to load AOT code");
+       return;
+     }
+     task->clear_aot();
+   }
    BufferBlob* buffer_blob = CompilerThread::current()->get_buffer_blob();
    assert(buffer_blob != nullptr, "Must exist");
    // invoke compilation
    {
      // We are nested here because we need for the destructor
< prev index next >