< prev index next >

src/hotspot/share/opto/output.cpp

Print this page
@@ -1348,11 +1348,11 @@
    // nmethod and CodeBuffer count stubs & constants as part of method's code.
    // class HandlerImpl is platform-specific and defined in the *.ad files.
    int exception_handler_req = HandlerImpl::size_exception_handler() + MAX_stubs_size; // add marginal slop for handler
    int deopt_handler_req     = HandlerImpl::size_deopt_handler()     + MAX_stubs_size; // add marginal slop for handler
    stub_req += MAX_stubs_size;   // ensure per-stub margin
-   code_req += MAX_inst_size;    // ensure per-instruction margin
+   code_req += max_inst_size();  // ensure per-instruction margin
  
    if (StressCodeBuffers)
      code_req = const_req = stub_req = exception_handler_req = deopt_handler_req = 0x10;  // force expansion
  
    int total_req =

@@ -1525,11 +1525,11 @@
            MachNode *nop = new MachNopNode(nops_cnt);
            block->insert_node(nop, j++);
            last_inst++;
            C->cfg()->map_node_to_block(nop, block);
            // Ensure enough space.
-           masm->code()->insts()->maybe_expand_to_ensure_remaining(MAX_inst_size);
+           masm->code()->insts()->maybe_expand_to_ensure_remaining(max_inst_size());
            if ((masm->code()->blob() == nullptr) || (!CompileBroker::should_compile_new_jobs())) {
              C->record_failure("CodeCache is full");
              return;
            }
            nop->emit(masm, C->regalloc());

@@ -1651,11 +1651,11 @@
            inct_starts[inct_cnt++] = current_offset;
          }
        }
  
        // Verify that there is sufficient space remaining
-       masm->code()->insts()->maybe_expand_to_ensure_remaining(MAX_inst_size);
+       masm->code()->insts()->maybe_expand_to_ensure_remaining(max_inst_size());
        if ((masm->code()->blob() == nullptr) || (!CompileBroker::should_compile_new_jobs())) {
          C->record_failure("CodeCache is full");
          return;
        }
  

@@ -1812,31 +1812,29 @@
  #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'" : ""));
        }
        if (C->method() != nullptr) {
          tty->print_cr("----------------------- MetaData before Compile_id = %d ------------------------", C->compile_id());
          tty->print_raw(method_metadata_str.freeze());
        } else if (C->stub_name() != nullptr) {

@@ -3119,11 +3117,11 @@
    // may be shared by several calls to scratch_emit_size.
    // The allocation of the scratch buffer blob is particularly
    // expensive, since it has to grab the code cache lock.
    BufferBlob* blob = this->scratch_buffer_blob();
    assert(blob != nullptr, "Initialize BufferBlob at start");
-   assert(blob->size() > MAX_inst_size, "sanity");
+   assert(blob->size() > max_inst_size(), "sanity");
    relocInfo* locs_buf = scratch_locs_memory();
    address blob_begin = blob->content_begin();
    address blob_end   = (address)locs_buf;
    assert(blob->contains(blob_end), "sanity");
    CodeBuffer buf(blob_begin, blob_end - blob_begin);

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

@@ -3216,19 +3212,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) {

@@ -3401,5 +3401,19 @@
  #ifndef PRODUCT
  void PhaseOutput::print_statistics() {
    Scheduling::print_statistics();
  }
  #endif
+ 
+ int PhaseOutput::max_inst_size() {
+   if (AOTCodeCache::maybe_dumping_code()) {
+     // See the comment in output.hpp.
+     return 16384;
+   } else {
+     return mainline_MAX_inst_size;
+   }
+ }
+ 
+ int PhaseOutput::max_inst_gcstub_size() {
+   assert(mainline_MAX_inst_size <= max_inst_size(), "Sanity");
+   return mainline_MAX_inst_size;
+ }
< prev index next >