< prev index next >

src/hotspot/share/opto/output.cpp

Print this page
@@ -3403,18 +3403,16 @@
  
    return buf.insts_size();
  }
  
  void PhaseOutput::install() {
-   if (!C->should_install_code()) {
-     return;
-   } else if (C->stub_function() != nullptr) {
+   if (C->should_install_code() && C->stub_function() != nullptr) {
      install_stub(C->stub_name());
    } else {
      install_code(C->method(),
                   C->entry_bci(),
-                  CompileBroker::compiler2(),
+                  CompilerThread::current()->compiler(),
                   C->has_unsafe_access(),
                   SharedRuntime::is_wide_vector(C->max_vector_size()));
    }
  }
  

@@ -3455,19 +3453,31 @@
                                       frame_size_in_words(),
                                       oop_map_set(),
                                       &_handler_table,
                                       inc_table(),
                                       compiler,
+                                      C->has_clinit_barriers(),
+                                      C->for_preload(),
                                       has_unsafe_access,
                                       SharedRuntime::is_wide_vector(C->max_vector_size()),
                                       C->has_monitors(),
                                       C->has_scoped_access(),
-                                      0);
+                                      0,
+                                      C->should_install_code());
  
      if (C->log() != nullptr) { // Print code cache state into compiler log
        C->log()->code_cache_state();
      }
+     if (C->has_clinit_barriers()) {
+       assert(C->for_preload(), "sanity");
+       // Build second version of code without class initialization barriers
+       if (C->env()->task()->compile_reason() == CompileTask::Reason_PrecompileForPreload) {
+         // don't automatically precompile a barrier-free version unless explicitly asked
+       } else {
+         C->record_failure(C2Compiler::retry_no_clinit_barriers());
+       }
+     }
    }
  }
  void PhaseOutput::install_stub(const char* stub_name) {
    // Entry point will be accessed using stub_entry_point();
    if (code_buffer() == nullptr) {
< prev index next >