hotspot Cdiff src/share/vm/compiler/compileBroker.cpp (original) (raw)

src/share/vm/compiler/compileBroker.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File hotspot Cdiff src/share/vm/compiler/compileBroker.cpp Print this page


*** 49,58 **** --- 49,63 ---- #include "utilities/dtrace.hpp" #include "utilities/events.hpp" #ifdef COMPILER1 #include "c1/c1_Compiler.hpp" #endif


*** 384,393 **** --- 389,400 ---- bool is_osr_method, int osr_bci, bool is_blocking, const char* msg, bool short_form, bool cr) { if (!short_form) { st->print("%7d ", (int) st->time_stamp().milliseconds()); // print timestamp }


*** 516,526 **** } // else compile_kind='c2c' if (!method.is_null()) log->method(method); if (_osr_bci != CompileBroker::standard_entry_bci) { log->print(" osr_bci='%d'", _osr_bci); } ! if (_comp_level != CompLevel_highest_tier) { log->print(" level='%d'", _comp_level); } if (_is_blocking) { log->print(" blocking='1'"); } --- 523,534 ---- } // else compile_kind='c2c' if (!method.is_null()) log->method(method); if (_osr_bci != CompileBroker::standard_entry_bci) { log->print(" osr_bci='%d'", _osr_bci); } ! // Always print the level in tiered. ! if (_comp_level != CompLevel_highest_tier || TieredCompilation) { log->print(" level='%d'", _comp_level); } if (_is_blocking) { log->print(" blocking='1'"); }


*** 553,562 **** --- 561,588 ---- xtty->end_elem(); }

// ------------------------------------------------------------------


*** 869,888 **** --- 895,940 ---- } #ifndef SHARK // Set the interface to the current compiler(s). int c1_count = CompilationPolicy::policy()->compiler_count(CompLevel_simple); int c2_count = CompilationPolicy::policy()->compiler_count(CompLevel_full_optimization);

+

#endif // COMPILER2

#else // SHARK int c1_count = 0; int c2_count = 1;


*** 1097,1107 ****
char name_buffer[256]; const bool compiler_thread = true; for (int i = 0; i < c2_compiler_count; i++) { // Create a name for our thread. ! sprintf(name_buffer, "C2 CompilerThread%d", i); CompilerCounters* counters = new CompilerCounters("compilerThread", i, CHECK); // Shark and C2 make_thread(name_buffer, _c2_compile_queue, counters, _compilers[1], compiler_thread, CHECK); }
--- 1149,1159 ----
char name_buffer[256]; const bool compiler_thread = true; for (int i = 0; i < c2_compiler_count; i++) { // Create a name for our thread. ! sprintf(name_buffer, "%s CompilerThread%d", _compilers[1]->name(), i); CompilerCounters* counters = new CompilerCounters("compilerThread", i, CHECK); // Shark and C2 make_thread(name_buffer, _c2_compile_queue, counters, _compilers[1], compiler_thread, CHECK); }

*** 1167,1177 **** tty->print("request: "); method->print_short_name(tty); if (osr_bci != InvocationEntryBci) { tty->print(" osr_bci: %d", osr_bci); } ! tty->print(" comment: %s count: %d", comment, hot_count); if (!hot_method.is_null()) { tty->print(" hot: "); if (hot_method() != method()) { hot_method->print_short_name(tty); } else { --- 1219,1229 ---- tty->print("request: "); method->print_short_name(tty); if (osr_bci != InvocationEntryBci) { tty->print(" osr_bci: %d", osr_bci); } ! tty->print(" level: %d comment: %s count: %d", comp_level, comment, hot_count); if (!hot_method.is_null()) { tty->print(" hot: "); if (hot_method() != method()) { hot_method->print_short_name(tty); } else {


*** 1259,1268 **** --- 1311,1355 ---- }

  // Should this thread wait for completion of the compile?
  blocking = is_compile_blocking();

*** 1440,1450 **** compile_method_base(method, osr_bci, comp_level, hot_method, hot_count, comment, THREAD); }

// return requested nmethod
// We accept a higher level osr method

! return osr_bci == InvocationEntryBci ? method->code() : method->lookup_osr_nmethod_for(osr_bci, comp_level, false); }

// ------------------------------------------------------------------ // CompileBroker::compilation_is_complete --- 1527,1540 ---- compile_method_base(method, osr_bci, comp_level, hot_method, hot_count, comment, THREAD); }

// return requested nmethod
// We accept a higher level osr method

! if (osr_bci == InvocationEntryBci) { ! return method->code(); ! } ! return method->lookup_osr_nmethod_for(osr_bci, comp_level, false); }

// ------------------------------------------------------------------ // CompileBroker::compilation_is_complete


*** 1563,1572 **** --- 1653,1671 ---- // only _compilation_id is incremented. return Atomic::add(1, &_compilation_id); #endif }


*** 1922,1931 **** --- 2021,2059 ---- } ttyLocker ttyl; tty->print("%s", s.as_string()); }


*** 1970,1985 ****

// Allocate a new set of JNI handles.
push_jni_handle_block();
Method* target_handle = task->method();
int compilable = ciEnv::MethodCompilable;

! { int system_dictionary_modification_counter; { MutexLocker locker(Compile_lock, thread); system_dictionary_modification_counter = SystemDictionary::number_of_modifications(); }

  NoHandleMark  nhm;
  ThreadToNativeFromVM ttn(thread);

  ciEnv ci_env(task, system_dictionary_modification_counter);

--- 2098,2128 ----

// Allocate a new set of JNI handles.
push_jni_handle_block();
Method* target_handle = task->method();
int compilable = ciEnv::MethodCompilable;

! AbstractCompiler *comp = compiler(task_level); ! int system_dictionary_modification_counter; { MutexLocker locker(Compile_lock, thread); system_dictionary_modification_counter = SystemDictionary::number_of_modifications(); }


*** 2001,2011 **** ciMethod* target = ci_env.get_method_from_handle(target_handle);

  TraceTime t1("compilation", &time);
  EventCompilation event;

--- 2144,2153 ----


*** 2037,2068 **** FormatBufferResource msg = retry_message != NULL ? err_msg_res("COMPILE SKIPPED: %s (%s)", ci_env.failure_reason(), retry_message) : err_msg_res("COMPILE SKIPPED: %s", ci_env.failure_reason()); task->print_compilation(tty, msg); } - } else { - task->mark_success(); - task->set_num_inlined_bytecodes(ci_env.num_inlined_bytecodes()); - if (_compilation_log != NULL) { - nmethod* code = task->code(); - if (code != NULL) { - _compilation_log->log_nmethod(thread, code); - } - } - } - // simulate crash during compilation - assert(task->compile_id() != CICrashAt, "just as planned"); - if (event.should_commit()) { - event.set_method(target->get_Method()); - event.set_compileID(compile_id); - event.set_compileLevel(task->comp_level()); - event.set_succeded(task->is_success()); - event.set_isOsr(is_osr); - event.set_codeSize((task->code() == NULL) ? 0 : task->code()->total_size()); - event.set_inlinedBytes(task->num_inlined_bytecodes()); - event.commit(); } } pop_jni_handle_block();
methodHandle method(thread, task->method());
--- 2179,2191 ---- FormatBufferResource msg = retry_message != NULL ? err_msg_res("COMPILE SKIPPED: %s (%s)", ci_env.failure_reason(), retry_message) : err_msg_res("COMPILE SKIPPED: %s", ci_env.failure_reason()); task->print_compilation(tty, msg); } } + + post_compile(thread, task, event, !ci_env.failing(), &ci_env); } pop_jni_handle_block();
methodHandle method(thread, task->method());

*** 2309,2325 **** // java.lang.management.CompilationMBean _perf_total_compilation->inc(time.ticks()); _peak_compilation_time = time.milliseconds() > _peak_compilation_time ? time.milliseconds() : _peak_compilation_time;

  if (CITime) {
    if (is_osr) {
      _t_osr_compilation.add(time);

! _sum_osr_bytes_compiled += method->code_size() + task->num_inlined_bytecodes(); } else { _t_standard_compilation.add(time); _sum_standard_bytes_compiled += method->code_size() + task->num_inlined_bytecodes(); } }

  if (UsePerfData) {
    // save the name of the last method compiled
    _perf_last_method->set_value(counters->current_method());

--- 2432,2454 ---- // java.lang.management.CompilationMBean _perf_total_compilation->inc(time.ticks()); _peak_compilation_time = time.milliseconds() > _peak_compilation_time ? time.milliseconds() : _peak_compilation_time;

  if (CITime) {

! _sum_osr_bytes_compiled += bytes_compiled; ! JVMCI_ONLY(stats->_osr.update(time, bytes_compiled);) } else { _t_standard_compilation.add(time); _sum_standard_bytes_compiled += method->code_size() + task->num_inlined_bytecodes();


*** 2371,2396 **** } else { return (comp->name()); } }

! void CompileBroker::print_times() { tty->cr(); tty->print_cr("Accumulated compiler times"); tty->print_cr("----------------------------------------------------------"); //0000000000111111111122222222223333333333444444444455555555556666666666 //0123456789012345678901234567890123456789012345678901234567890123456789 ! tty->print_cr(" Total compilation time : %7.3f s", CompileBroker::_t_total_compilation.seconds()); tty->print_cr(" Standard compilation : %7.3f s, Average : %2.3f s", ! CompileBroker::_t_standard_compilation.seconds(), ! CompileBroker::_t_standard_compilation.seconds() / CompileBroker::_total_standard_compile_count); tty->print_cr(" Bailed out compilation : %7.3f s, Average : %2.3f s", CompileBroker::_t_bailedout_compilation.seconds(), CompileBroker::_t_bailedout_compilation.seconds() / CompileBroker::_total_bailout_count); tty->print_cr(" On stack replacement : %7.3f s, Average : %2.3f s", ! CompileBroker::_t_osr_compilation.seconds(), ! CompileBroker::_t_osr_compilation.seconds() / CompileBroker::_total_osr_compile_count); tty->print_cr(" Invalidated : %7.3f s, Average : %2.3f s", CompileBroker::_t_invalidated_compilation.seconds(), CompileBroker::_t_invalidated_compilation.seconds() / CompileBroker::_total_invalidated_count);

AbstractCompiler *comp = compiler(CompLevel_simple);

--- 2500,2609 ---- } else { return (comp->name()); } }

! #if INCLUDE_JVMCI ! void CompileBroker::print_times(AbstractCompiler* comp) { ! CompilerStatistics* stats = comp->stats(); ! tty->print_cr(" %s {speed: %d bytes/s; standard: %6.3f s, %d bytes, %d methods; osr: %6.3f s, %d bytes, %d methods; nmethods_size: %d bytes; nmethods_code_size: %d bytes}", ! comp->name(), stats->bytes_per_second(), ! stats->_standard._time.seconds(), stats->_standard._bytes, stats->_standard._count, ! stats->_osr._time.seconds(), stats->_osr._bytes, stats->_osr._count, ! stats->_nmethods_size, stats->_nmethods_code_size); ! comp->print_timers(); ! } ! #endif ! ! void CompileBroker::print_times(bool per_compiler, bool aggregate) { ! #if INCLUDE_JVMCI ! elapsedTimer standard_compilation; ! elapsedTimer total_compilation; ! elapsedTimer osr_compilation; ! ! int standard_bytes_compiled = 0; ! int osr_bytes_compiled = 0; ! ! int standard_compile_count = 0; ! int osr_compile_count = 0; ! int total_compile_count = 0; ! ! int nmethods_size = 0; ! int nmethods_code_size = 0; ! bool printedHeader = false; ! ! for (unsigned int i = 0; i < sizeof(_compilers) / sizeof(AbstractCompiler*); i++) { ! AbstractCompiler* comp = _compilers[i]; ! if (comp != NULL) { ! if (per_compiler && aggregate && !printedHeader) { ! printedHeader = true; ! tty->cr(); ! tty->print_cr("Individual compiler times (for compiled methods only)"); ! tty->print_cr("------------------------------------------------"); ! tty->cr(); ! } ! CompilerStatistics* stats = comp->stats(); ! ! standard_compilation.add(stats->_standard._time); ! osr_compilation.add(stats->_osr._time); ! ! standard_bytes_compiled += stats->_standard._bytes; ! osr_bytes_compiled += stats->_osr._bytes; ! ! standard_compile_count += stats->_standard._count; ! osr_compile_count += stats->_osr._count; ! ! nmethods_size += stats->_nmethods_size; ! nmethods_code_size += stats->_nmethods_code_size; ! ! if (per_compiler) { ! print_times(comp); ! } ! } ! } ! total_compile_count = osr_compile_count + standard_compile_count; ! total_compilation.add(osr_compilation); ! total_compilation.add(standard_compilation); ! ! // In hosted mode, print the JVMCI compiler specific counters manually. ! if (!UseJVMCICompiler) { ! JVMCICompiler::print_compilation_timers(); ! } ! #else ! elapsedTimer standard_compilation = CompileBroker::_t_standard_compilation; ! elapsedTimer osr_compilation = CompileBroker::_t_osr_compilation; ! elapsedTimer total_compilation = CompileBroker::_t_total_compilation; ! ! int standard_bytes_compiled = CompileBroker::_sum_standard_bytes_compiled; ! int osr_bytes_compiled = CompileBroker::_sum_osr_bytes_compiled; ! ! int standard_compile_count = CompileBroker::_total_standard_compile_count; ! int osr_compile_count = CompileBroker::_total_osr_compile_count; ! int total_compile_count = CompileBroker::_total_compile_count; ! ! int nmethods_size = CompileBroker::_sum_nmethod_code_size; ! int nmethods_code_size = CompileBroker::_sum_nmethod_size; ! #endif ! ! if (!aggregate) { ! return; ! } tty->cr(); tty->print_cr("Accumulated compiler times"); tty->print_cr("----------------------------------------------------------"); //0000000000111111111122222222223333333333444444444455555555556666666666 //0123456789012345678901234567890123456789012345678901234567890123456789 ! tty->print_cr(" Total compilation time : %7.3f s", total_compilation.seconds()); tty->print_cr(" Standard compilation : %7.3f s, Average : %2.3f s", ! standard_compilation.seconds(), ! standard_compilation.seconds() / standard_compile_count); tty->print_cr(" Bailed out compilation : %7.3f s, Average : %2.3f s", CompileBroker::_t_bailedout_compilation.seconds(), CompileBroker::_t_bailedout_compilation.seconds() / CompileBroker::_total_bailout_count); tty->print_cr(" On stack replacement : %7.3f s, Average : %2.3f s", ! osr_compilation.seconds(), ! osr_compilation.seconds() / osr_compile_count); tty->print_cr(" Invalidated : %7.3f s, Average : %2.3f s", CompileBroker::_t_invalidated_compilation.seconds(), CompileBroker::_t_invalidated_compilation.seconds() / CompileBroker::_total_invalidated_count);

AbstractCompiler *comp = compiler(CompLevel_simple);

*** 2402,2423 **** if (comp != NULL) { tty->cr(); comp->print_timers(); } tty->cr(); ! tty->print_cr(" Total compiled methods : %8d methods", CompileBroker::_total_compile_count); ! tty->print_cr(" Standard compilation : %8d methods", CompileBroker::_total_standard_compile_count); ! tty->print_cr(" On stack replacement : %8d methods", CompileBroker::_total_osr_compile_count); ! int tcb = CompileBroker::_sum_osr_bytes_compiled + CompileBroker::_sum_standard_bytes_compiled; tty->print_cr(" Total compiled bytecodes : %8d bytes", tcb); ! tty->print_cr(" Standard compilation : %8d bytes", CompileBroker::_sum_standard_bytes_compiled); ! tty->print_cr(" On stack replacement : %8d bytes", CompileBroker::_sum_osr_bytes_compiled); ! int bps = (int)(tcb / CompileBroker::_t_total_compilation.seconds()); tty->print_cr(" Average compilation speed : %8d bytes/s", bps); tty->cr(); ! tty->print_cr(" nmethod code size : %8d bytes", CompileBroker::_sum_nmethod_code_size); ! tty->print_cr(" nmethod total size : %8d bytes", CompileBroker::_sum_nmethod_size); }

// Debugging output for failure void CompileBroker::print_last_compile() { if ( _last_compile_level != CompLevel_none && --- 2615,2637 ---- if (comp != NULL) { tty->cr(); comp->print_timers(); } tty->cr(); ! tty->print_cr(" Total compiled methods : %8d methods", total_compile_count); ! tty->print_cr(" Standard compilation : %8d methods", standard_compile_count); ! tty->print_cr(" On stack replacement : %8d methods", osr_compile_count); ! int tcb = osr_bytes_compiled + standard_bytes_compiled; tty->print_cr(" Total compiled bytecodes : %8d bytes", tcb); ! tty->print_cr(" Standard compilation : %8d bytes", standard_bytes_compiled); ! tty->print_cr(" On stack replacement : %8d bytes", osr_bytes_compiled); ! double tcs = total_compilation.seconds(); ! int bps = tcs == 0.0 ? 0 : (int)(tcb / tcs); tty->print_cr(" Average compilation speed : %8d bytes/s", bps); tty->cr(); ! tty->print_cr(" nmethod code size : %8d bytes", nmethods_code_size); ! tty->print_cr(" nmethod total size : %8d bytes", nmethods_size); }

// Debugging output for failure void CompileBroker::print_last_compile() { if ( _last_compile_level != CompLevel_none &&

src/share/vm/compiler/compileBroker.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File