< prev index next >

src/hotspot/share/opto/output.cpp

Print this page
@@ -1799,40 +1799,39 @@
  #endif
  
  #if defined(SUPPORT_OPTO_ASSEMBLY)
    // Dump the assembly code, including basic-block numbers
    if (C->print_assembly()) {
-     ttyLocker ttyl;  // keep the following output all in one block
-     if (!VMThread::should_terminate()) {  // test this under the tty lock
-       // print_metadata and dump_asm may safepoint which makes us loose the ttylock.
-       // We call them first and write to a stringStream, then we retake the lock to
-       // make sure the end tag is coherent, and that xmlStream->pop_tag is done thread safe.
+     if (!VMThread::should_terminate()) {
        ResourceMark rm;
        stringStream method_metadata_str;
        if (C->method() != nullptr) {
          C->method()->print_metadata(&method_metadata_str);
        }
        stringStream dump_asm_str;
        dump_asm_on(&dump_asm_str, node_offsets, node_offset_limit);
  
+       // Make sure the end tag is coherent, and that xmlStream->pop_tag is done thread safe.
        NoSafepointVerifier nsv;
-       ttyLocker ttyl2;
+       ttyLocker ttyl;
        // This output goes directly to the tty, not the compiler log.
        // To enable tools to match it up with the compilation activity,
        // be sure to tag this tty output with the compile ID.
        if (xtty != nullptr) {
          xtty->head("opto_assembly compile_id='%d'%s", C->compile_id(),
-                    C->is_osr_compilation() ? " compile_kind='osr'" : "");
+                    C->is_osr_compilation() ? " compile_kind='osr'" :
+                    (C->for_preload() ? " compile_kind='AP'" : ""));
        }
+       const char* is_aot = C->env()->is_aot_compile() ? (C->for_preload() ? "(AP) " : "(A) -") : "-----";
        if (C->method() != nullptr) {
-         tty->print_cr("----------------------- MetaData before Compile_id = %d ------------------------", C->compile_id());
+         tty->print_cr("----------------------- MetaData before Compile_id = %d %s-------------------", C->compile_id(), is_aot);
          tty->print_raw(method_metadata_str.freeze());
        } else if (C->stub_name() != nullptr) {
          tty->print_cr("----------------------------- RuntimeStub %s -------------------------------", C->stub_name());
        }
        tty->cr();
-       tty->print_cr("------------------------ OptoAssembly for Compile_id = %d -----------------------", C->compile_id());
+       tty->print_cr("------------------------ OptoAssembly for Compile_id = %d %s------------------", C->compile_id(), is_aot);
        tty->print_raw(dump_asm_str.freeze());
        tty->print_cr("--------------------------------------------------------------------------------");
        if (xtty != nullptr) {
          xtty->tail("opto_assembly");
        }

@@ -3151,18 +3150,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()));
    }
  }
  

@@ -3203,19 +3200,23 @@
                                       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();
      }
+     assert(!C->has_clinit_barriers() || C->for_preload(), "class init barriers should be only in preload code");
    }
  }
  void PhaseOutput::install_stub(const char* stub_name) {
    // Entry point will be accessed using stub_entry_point();
    if (code_buffer() == nullptr) {
< prev index next >