< prev index next >

src/hotspot/share/runtime/sharedRuntime.cpp

Print this page
*** 21,10 ***
--- 21,11 ---
   * questions.
   *
   */
  
  #include "precompiled.hpp"
+ #include "classfile/classLoader.hpp"
  #include "classfile/javaClasses.inline.hpp"
  #include "classfile/stringTable.hpp"
  #include "classfile/vmClasses.hpp"
  #include "classfile/vmSymbols.hpp"
  #include "code/codeCache.hpp"

*** 61,17 ***
--- 62,19 ---
  #include "runtime/init.hpp"
  #include "runtime/interfaceSupport.inline.hpp"
  #include "runtime/java.hpp"
  #include "runtime/javaCalls.hpp"
  #include "runtime/jniHandles.inline.hpp"
+ #include "runtime/perfData.inline.hpp"
  #include "runtime/sharedRuntime.hpp"
  #include "runtime/stackWatermarkSet.hpp"
  #include "runtime/stubRoutines.hpp"
  #include "runtime/synchronizer.hpp"
  #include "runtime/vframe.inline.hpp"
  #include "runtime/vframeArray.hpp"
  #include "runtime/vm_version.hpp"
+ #include "services/management.hpp"
  #include "utilities/copy.hpp"
  #include "utilities/dtrace.hpp"
  #include "utilities/events.hpp"
  #include "utilities/resourceHash.hpp"
  #include "utilities/macros.hpp"

*** 101,10 ***
--- 104,16 ---
  UncommonTrapBlob*   SharedRuntime::_uncommon_trap_blob;
  #endif // COMPILER2
  
  nmethod*            SharedRuntime::_cont_doYield_stub;
  
+ PerfTickCounters* SharedRuntime::_perf_resolve_opt_virtual_total_time = nullptr;
+ PerfTickCounters* SharedRuntime::_perf_resolve_virtual_total_time     = nullptr;
+ PerfTickCounters* SharedRuntime::_perf_resolve_static_total_time      = nullptr;
+ PerfTickCounters* SharedRuntime::_perf_handle_wrong_method_total_time = nullptr;
+ PerfTickCounters* SharedRuntime::_perf_ic_miss_total_time             = nullptr;
+ 
  //----------------------------generate_stubs-----------------------------------
  void SharedRuntime::generate_stubs() {
    _wrong_method_blob                   = generate_resolve_blob(CAST_FROM_FN_PTR(address, SharedRuntime::handle_wrong_method),          "wrong_method_stub");
    _wrong_method_abstract_blob          = generate_resolve_blob(CAST_FROM_FN_PTR(address, SharedRuntime::handle_wrong_method_abstract), "wrong_method_abstract_stub");
    _ic_miss_blob                        = generate_resolve_blob(CAST_FROM_FN_PTR(address, SharedRuntime::handle_wrong_method_ic_miss),  "ic_miss_stub");

*** 128,23 ***
    generate_deopt_blob();
  
  #ifdef COMPILER2
    generate_uncommon_trap_blob();
  #endif // COMPILER2
  }
  
  #include <math.h>
  
  // Implementation of SharedRuntime
  
- #ifndef PRODUCT
  // For statistics
  uint SharedRuntime::_ic_miss_ctr = 0;
  uint SharedRuntime::_wrong_method_ctr = 0;
  uint SharedRuntime::_resolve_static_ctr = 0;
  uint SharedRuntime::_resolve_virtual_ctr = 0;
  uint SharedRuntime::_resolve_opt_virtual_ctr = 0;
  uint SharedRuntime::_implicit_null_throws = 0;
  uint SharedRuntime::_implicit_div0_throws = 0;
  
  int64_t SharedRuntime::_nof_normal_calls = 0;
  int64_t SharedRuntime::_nof_inlined_calls = 0;
--- 137,75 ---
    generate_deopt_blob();
  
  #ifdef COMPILER2
    generate_uncommon_trap_blob();
  #endif // COMPILER2
+   if (UsePerfData) {
+     EXCEPTION_MARK;
+     NEWPERFTICKCOUNTERS(_perf_resolve_opt_virtual_total_time, SUN_CI, "resovle_opt_virtual_call");
+     NEWPERFTICKCOUNTERS(_perf_resolve_virtual_total_time,     SUN_CI, "resovle_virtual_call");
+     NEWPERFTICKCOUNTERS(_perf_resolve_static_total_time,      SUN_CI, "resovle_static_call");
+     NEWPERFTICKCOUNTERS(_perf_handle_wrong_method_total_time, SUN_CI, "handle_wrong_method");
+     NEWPERFTICKCOUNTERS(_perf_ic_miss_total_time ,            SUN_CI, "ic_miss");
+     if (HAS_PENDING_EXCEPTION) {
+       vm_exit_during_initialization("SharedRuntime::generate_stubs() failed unexpectedly");
+     }
+   }
+ }
+ 
+ void SharedRuntime::print_counters_on(outputStream* st) {
+   st->print_cr("SharedRuntime:");
+   if (UsePerfData) {
+     st->print_cr("  resolve_opt_virtual_call: %5ldms (elapsed) %5ldms (thread) / %5d events",
+                  _perf_resolve_opt_virtual_total_time->elapsed_counter_value_ms(),
+                  _perf_resolve_opt_virtual_total_time->thread_counter_value_ms(),
+                  _resolve_opt_virtual_ctr);
+     st->print_cr("  resolve_virtual_call:     %5ldms (elapsed) %5ldms (thread) / %5d events",
+                  _perf_resolve_virtual_total_time->elapsed_counter_value_ms(),
+                  _perf_resolve_virtual_total_time->thread_counter_value_ms(),
+                  _resolve_virtual_ctr);
+     st->print_cr("  resolve_static_call:      %5ldms (elapsed) %5ldms (thread) / %5d events",
+                  _perf_resolve_static_total_time->elapsed_counter_value_ms(),
+                  _perf_resolve_static_total_time->thread_counter_value_ms(),
+                  _resolve_static_ctr);
+     st->print_cr("  handle_wrong_method:      %5ldms (elapsed) %5ldms (thread) / %5d events",
+                  _perf_handle_wrong_method_total_time->elapsed_counter_value_ms(),
+                  _perf_handle_wrong_method_total_time->thread_counter_value_ms(),
+                  _wrong_method_ctr);
+     st->print_cr("  ic_miss:                  %5ldms (elapsed) %5ldms (thread) / %5d events",
+                  _perf_ic_miss_total_time->elapsed_counter_value_ms(),
+                  _perf_ic_miss_total_time->thread_counter_value_ms(),
+                  _ic_miss_ctr);
+ 
+     jlong total_elapsed_time_ms = Management::ticks_to_ms(_perf_resolve_opt_virtual_total_time->elapsed_counter_value() +
+                                                           _perf_resolve_virtual_total_time->elapsed_counter_value() +
+                                                           _perf_resolve_static_total_time->elapsed_counter_value() +
+                                                           _perf_handle_wrong_method_total_time->elapsed_counter_value() +
+                                                           _perf_ic_miss_total_time->elapsed_counter_value());
+     jlong total_thread_time_ms = Management::ticks_to_ms(_perf_resolve_opt_virtual_total_time->thread_counter_value() +
+                                                           _perf_resolve_virtual_total_time->thread_counter_value() +
+                                                           _perf_resolve_static_total_time->thread_counter_value() +
+                                                           _perf_handle_wrong_method_total_time->thread_counter_value() +
+                                                           _perf_ic_miss_total_time->thread_counter_value());
+     st->print_cr("Total:                      %5ldms (elapsed) %5ldms (thread)", total_elapsed_time_ms, total_thread_time_ms);
+   } else {
+     st->print_cr("  no data (UsePerfData is turned off)");
+   }
  }
  
  #include <math.h>
  
  // Implementation of SharedRuntime
  
  // For statistics
  uint SharedRuntime::_ic_miss_ctr = 0;
  uint SharedRuntime::_wrong_method_ctr = 0;
  uint SharedRuntime::_resolve_static_ctr = 0;
  uint SharedRuntime::_resolve_virtual_ctr = 0;
  uint SharedRuntime::_resolve_opt_virtual_ctr = 0;
+ 
+ #ifndef PRODUCT
  uint SharedRuntime::_implicit_null_throws = 0;
  uint SharedRuntime::_implicit_div0_throws = 0;
  
  int64_t SharedRuntime::_nof_normal_calls = 0;
  int64_t SharedRuntime::_nof_inlined_calls = 0;

*** 193,22 ***
    if (_ICmiss_index >= maxICmiss_count) _ICmiss_index = maxICmiss_count - 1;
    _ICmiss_at[index] = at;
    _ICmiss_count[index] = 1;
  }
  
! void SharedRuntime::print_ic_miss_histogram() {
    if (ICMissHistogram) {
!     tty->print_cr("IC Miss Histogram:");
      int tot_misses = 0;
      for (int i = 0; i < _ICmiss_index; i++) {
!       tty->print_cr("  at: " INTPTR_FORMAT "  nof: %d", p2i(_ICmiss_at[i]), _ICmiss_count[i]);
        tot_misses += _ICmiss_count[i];
      }
!     tty->print_cr("Total IC misses: %7d", tot_misses);
    }
  }
! #endif // PRODUCT
  
  
  JRT_LEAF(jlong, SharedRuntime::lmul(jlong y, jlong x))
    return x * y;
  JRT_END
--- 254,22 ---
    if (_ICmiss_index >= maxICmiss_count) _ICmiss_index = maxICmiss_count - 1;
    _ICmiss_at[index] = at;
    _ICmiss_count[index] = 1;
  }
  
! void SharedRuntime::print_ic_miss_histogram_on(outputStream* st) {
    if (ICMissHistogram) {
!     st->print_cr("IC Miss Histogram:");
      int tot_misses = 0;
      for (int i = 0; i < _ICmiss_index; i++) {
!       st->print_cr("  at: " INTPTR_FORMAT "  nof: %d", p2i(_ICmiss_at[i]), _ICmiss_count[i]);
        tot_misses += _ICmiss_count[i];
      }
!     st->print_cr("Total IC misses: %7d", tot_misses);
    }
  }
! #endif // !PRODUCT
  
  
  JRT_LEAF(jlong, SharedRuntime::lmul(jlong y, jlong x))
    return x * y;
  JRT_END

*** 675,10 ***
--- 736,22 ---
      // an error. Our method could have been redefined just after we
      // fetched the Method* from the constant pool.
      ResourceMark rm;
      log_trace(redefine, class, obsolete)("calling obsolete method '%s'", method->name_and_sig_as_C_string());
    }
+ 
+   LogStreamHandle(Trace, interpreter, bytecode) log;
+   if (log.is_enabled()) {
+     ResourceMark rm;
+     log.print("method entry: " INTPTR_FORMAT " %s %s%s%s%s",
+               p2i(thread),
+               (method->is_static() ? "static" : "virtual"),
+               method->name_and_sig_as_C_string(),
+               (method->is_native() ? " native" : ""),
+               (thread->class_being_initialized() != nullptr ? " clinit" : ""),
+               (method->method_holder()->is_initialized() ? "" : " being_initialized"));
+   }
    return 0;
  JRT_END
  
  // ret_pc points into caller; we are returning caller's exception handler
  // for given exception

*** 1315,17 ***
           (!is_virtual && invoke_code == Bytecodes::_invokedynamic) ||
           ( is_virtual && invoke_code != Bytecodes::_invokestatic ), "inconsistent bytecode");
  
    assert(!caller_nm->is_unloading(), "It should not be unloading");
  
- #ifndef PRODUCT
    // tracing/debugging/statistics
    uint *addr = (is_optimized) ? (&_resolve_opt_virtual_ctr) :
                   (is_virtual) ? (&_resolve_virtual_ctr) :
                                  (&_resolve_static_ctr);
    Atomic::inc(addr);
  
    if (TraceCallFixup) {
      ResourceMark rm(current);
      tty->print("resolving %s%s (%s) call to",
                 (is_optimized) ? "optimized " : "", (is_virtual) ? "virtual" : "static",
                 Bytecodes::name(invoke_code));
--- 1388,17 ---
           (!is_virtual && invoke_code == Bytecodes::_invokedynamic) ||
           ( is_virtual && invoke_code != Bytecodes::_invokestatic ), "inconsistent bytecode");
  
    assert(!caller_nm->is_unloading(), "It should not be unloading");
  
    // tracing/debugging/statistics
    uint *addr = (is_optimized) ? (&_resolve_opt_virtual_ctr) :
                   (is_virtual) ? (&_resolve_virtual_ctr) :
                                  (&_resolve_static_ctr);
    Atomic::inc(addr);
  
+ #ifndef PRODUCT
    if (TraceCallFixup) {
      ResourceMark rm(current);
      tty->print("resolving %s%s (%s) call to",
                 (is_optimized) ? "optimized " : "", (is_virtual) ? "virtual" : "static",
                 Bytecodes::name(invoke_code));

*** 1377,10 ***
--- 1450,12 ---
    return callee_method;
  }
  
  // Inline caches exist only in compiled code
  JRT_BLOCK_ENTRY(address, SharedRuntime::handle_wrong_method_ic_miss(JavaThread* current))
+   PerfTraceTime timer(_perf_ic_miss_total_time);
+ 
  #ifdef ASSERT
    RegisterMap reg_map(current,
                        RegisterMap::UpdateMap::skip,
                        RegisterMap::ProcessFrames::include,
                        RegisterMap::WalkContinuation::skip);

*** 1402,10 ***
--- 1477,12 ---
  JRT_END
  
  
  // Handle call site that has been made non-entrant
  JRT_BLOCK_ENTRY(address, SharedRuntime::handle_wrong_method(JavaThread* current))
+   PerfTraceTime timer(_perf_handle_wrong_method_total_time);
+ 
    // 6243940 We might end up in here if the callee is deoptimized
    // as we race to call it.  We don't want to take a safepoint if
    // the caller was interpreted because the caller frame will look
    // interpreted to the stack walkers and arguments are now
    // "compiled" so it is much better to make this transition

*** 1455,10 ***
--- 1532,12 ---
    return callee_method->verified_code_entry();
  JRT_END
  
  // Handle abstract method call
  JRT_BLOCK_ENTRY(address, SharedRuntime::handle_wrong_method_abstract(JavaThread* current))
+   PerfTraceTime timer(_perf_handle_wrong_method_total_time);
+ 
    // Verbose error message for AbstractMethodError.
    // Get the called method from the invoke bytecode.
    vframeStream vfst(current, true);
    assert(!vfst.at_end(), "Java frame must exist");
    methodHandle caller(current, vfst.method());

*** 1490,10 ***
--- 1569,12 ---
  JRT_END
  
  
  // resolve a static call and patch code
  JRT_BLOCK_ENTRY(address, SharedRuntime::resolve_static_call_C(JavaThread* current ))
+   PerfTraceTime timer(_perf_resolve_static_total_time);
+ 
    methodHandle callee_method;
    bool enter_special = false;
    JRT_BLOCK
      callee_method = SharedRuntime::resolve_helper(false, false, CHECK_NULL);
      current->set_vm_result_2(callee_method());

*** 1528,10 ***
--- 1609,12 ---
  JRT_END
  
  
  // resolve virtual call and update inline cache to monomorphic
  JRT_BLOCK_ENTRY(address, SharedRuntime::resolve_virtual_call_C(JavaThread* current))
+   PerfTraceTime timer(_perf_resolve_virtual_total_time);
+ 
    methodHandle callee_method;
    JRT_BLOCK
      callee_method = SharedRuntime::resolve_helper(true, false, CHECK_NULL);
      current->set_vm_result_2(callee_method());
    JRT_BLOCK_END

*** 1542,10 ***
--- 1625,12 ---
  
  
  // Resolve a virtual call that can be statically bound (e.g., always
  // monomorphic, so it has no inline cache).  Patch code to resolved target.
  JRT_BLOCK_ENTRY(address, SharedRuntime::resolve_opt_virtual_call_C(JavaThread* current))
+   PerfTraceTime timer(_perf_resolve_opt_virtual_total_time);
+ 
    methodHandle callee_method;
    JRT_BLOCK
      callee_method = SharedRuntime::resolve_helper(true, true, CHECK_NULL);
      current->set_vm_result_2(callee_method());
    JRT_BLOCK_END

*** 1564,13 ***
    // receivers for non-static calls
    Handle receiver = find_callee_info(bc, call_info, CHECK_(methodHandle()));
  
    methodHandle callee_method(current, call_info.selected_method());
  
- #ifndef PRODUCT
    Atomic::inc(&_ic_miss_ctr);
  
    // Statistics & Tracing
    if (TraceCallFixup) {
      ResourceMark rm(current);
      tty->print("IC miss (%s) call to", Bytecodes::name(bc));
      callee_method->print_short_name(tty);
--- 1649,13 ---
    // receivers for non-static calls
    Handle receiver = find_callee_info(bc, call_info, CHECK_(methodHandle()));
  
    methodHandle callee_method(current, call_info.selected_method());
  
    Atomic::inc(&_ic_miss_ctr);
  
+ #ifndef PRODUCT
    // Statistics & Tracing
    if (TraceCallFixup) {
      ResourceMark rm(current);
      tty->print("IC miss (%s) call to", Bytecodes::name(bc));
      callee_method->print_short_name(tty);

*** 1688,14 ***
      }
    }
  
    methodHandle callee_method = find_callee_method(CHECK_(methodHandle()));
  
- 
- #ifndef PRODUCT
    Atomic::inc(&_wrong_method_ctr);
  
    if (TraceCallFixup) {
      ResourceMark rm(current);
      tty->print("handle_wrong_method reresolving call to");
      callee_method->print_short_name(tty);
      tty->print_cr(" code: " INTPTR_FORMAT, p2i(callee_method->code()));
--- 1773,13 ---
      }
    }
  
    methodHandle callee_method = find_callee_method(CHECK_(methodHandle()));
  
    Atomic::inc(&_wrong_method_ctr);
  
+ #ifndef PRODUCT
    if (TraceCallFixup) {
      ResourceMark rm(current);
      tty->print("handle_wrong_method reresolving call to");
      callee_method->print_short_name(tty);
      tty->print_cr(" code: " INTPTR_FORMAT, p2i(callee_method->code()));

*** 1954,48 ***
  
  void SharedRuntime::print_statistics() {
    ttyLocker ttyl;
    if (xtty != nullptr)  xtty->head("statistics type='SharedRuntime'");
  
!   SharedRuntime::print_ic_miss_histogram();
! 
!   // Dump the JRT_ENTRY counters
-   if (_new_instance_ctr) tty->print_cr("%5u new instance requires GC", _new_instance_ctr);
-   if (_new_array_ctr) tty->print_cr("%5u new array requires GC", _new_array_ctr);
-   if (_multi2_ctr) tty->print_cr("%5u multianewarray 2 dim", _multi2_ctr);
-   if (_multi3_ctr) tty->print_cr("%5u multianewarray 3 dim", _multi3_ctr);
-   if (_multi4_ctr) tty->print_cr("%5u multianewarray 4 dim", _multi4_ctr);
-   if (_multi5_ctr) tty->print_cr("%5u multianewarray 5 dim", _multi5_ctr);
- 
-   tty->print_cr("%5u inline cache miss in compiled", _ic_miss_ctr);
-   tty->print_cr("%5u wrong method", _wrong_method_ctr);
-   tty->print_cr("%5u unresolved static call site", _resolve_static_ctr);
-   tty->print_cr("%5u unresolved virtual call site", _resolve_virtual_ctr);
-   tty->print_cr("%5u unresolved opt virtual call site", _resolve_opt_virtual_ctr);
- 
-   if (_mon_enter_stub_ctr) tty->print_cr("%5u monitor enter stub", _mon_enter_stub_ctr);
-   if (_mon_exit_stub_ctr) tty->print_cr("%5u monitor exit stub", _mon_exit_stub_ctr);
-   if (_mon_enter_ctr) tty->print_cr("%5u monitor enter slow", _mon_enter_ctr);
-   if (_mon_exit_ctr) tty->print_cr("%5u monitor exit slow", _mon_exit_ctr);
-   if (_partial_subtype_ctr) tty->print_cr("%5u slow partial subtype", _partial_subtype_ctr);
-   if (_jbyte_array_copy_ctr) tty->print_cr("%5u byte array copies", _jbyte_array_copy_ctr);
-   if (_jshort_array_copy_ctr) tty->print_cr("%5u short array copies", _jshort_array_copy_ctr);
-   if (_jint_array_copy_ctr) tty->print_cr("%5u int array copies", _jint_array_copy_ctr);
-   if (_jlong_array_copy_ctr) tty->print_cr("%5u long array copies", _jlong_array_copy_ctr);
-   if (_oop_array_copy_ctr) tty->print_cr("%5u oop array copies", _oop_array_copy_ctr);
-   if (_checkcast_array_copy_ctr) tty->print_cr("%5u checkcast array copies", _checkcast_array_copy_ctr);
-   if (_unsafe_array_copy_ctr) tty->print_cr("%5u unsafe array copies", _unsafe_array_copy_ctr);
-   if (_generic_array_copy_ctr) tty->print_cr("%5u generic array copies", _generic_array_copy_ctr);
-   if (_slow_array_copy_ctr) tty->print_cr("%5u slow array copies", _slow_array_copy_ctr);
-   if (_find_handler_ctr) tty->print_cr("%5u find exception handler", _find_handler_ctr);
-   if (_rethrow_ctr) tty->print_cr("%5u rethrow handler", _rethrow_ctr);
- 
-   AdapterHandlerLibrary::print_statistics();
  
    if (xtty != nullptr)  xtty->tail("statistics");
  }
  
  inline double percent(int64_t x, int64_t y) {
    return 100.0 * (double)x / (double)MAX2(y, (int64_t)1);
  }
  
  class MethodArityHistogram {
--- 2038,50 ---
  
  void SharedRuntime::print_statistics() {
    ttyLocker ttyl;
    if (xtty != nullptr)  xtty->head("statistics type='SharedRuntime'");
  
!   SharedRuntime::print_ic_miss_histogram_on(tty);
!   SharedRuntime::print_counters_on(tty);
!   AdapterHandlerLibrary::print_statistics_on(tty);
  
    if (xtty != nullptr)  xtty->tail("statistics");
  }
  
+ //void SharedRuntime::print_counters_on(outputStream* st) {
+ //  // Dump the JRT_ENTRY counters
+ //  if (_new_instance_ctr) st->print_cr("%5u new instance requires GC", _new_instance_ctr);
+ //  if (_new_array_ctr)    st->print_cr("%5u new array requires GC", _new_array_ctr);
+ //  if (_multi2_ctr)       st->print_cr("%5u multianewarray 2 dim", _multi2_ctr);
+ //  if (_multi3_ctr)       st->print_cr("%5u multianewarray 3 dim", _multi3_ctr);
+ //  if (_multi4_ctr)       st->print_cr("%5u multianewarray 4 dim", _multi4_ctr);
+ //  if (_multi5_ctr)       st->print_cr("%5u multianewarray 5 dim", _multi5_ctr);
+ //
+ //  st->print_cr("%5u inline cache miss in compiled", _ic_miss_ctr);
+ //  st->print_cr("%5u wrong method", _wrong_method_ctr);
+ //  st->print_cr("%5u unresolved static call site", _resolve_static_ctr);
+ //  st->print_cr("%5u unresolved virtual call site", _resolve_virtual_ctr);
+ //  st->print_cr("%5u unresolved opt virtual call site", _resolve_opt_virtual_ctr);
+ //
+ //  if (_mon_enter_stub_ctr)       st->print_cr("%5u monitor enter stub", _mon_enter_stub_ctr);
+ //  if (_mon_exit_stub_ctr)        st->print_cr("%5u monitor exit stub", _mon_exit_stub_ctr);
+ //  if (_mon_enter_ctr)            st->print_cr("%5u monitor enter slow", _mon_enter_ctr);
+ //  if (_mon_exit_ctr)             st->print_cr("%5u monitor exit slow", _mon_exit_ctr);
+ //  if (_partial_subtype_ctr)      st->print_cr("%5u slow partial subtype", _partial_subtype_ctr);
+ //  if (_jbyte_array_copy_ctr)     st->print_cr("%5u byte array copies", _jbyte_array_copy_ctr);
+ //  if (_jshort_array_copy_ctr)    st->print_cr("%5u short array copies", _jshort_array_copy_ctr);
+ //  if (_jint_array_copy_ctr)      st->print_cr("%5u int array copies", _jint_array_copy_ctr);
+ //  if (_jlong_array_copy_ctr)     st->print_cr("%5u long array copies", _jlong_array_copy_ctr);
+ //  if (_oop_array_copy_ctr)       st->print_cr("%5u oop array copies", _oop_array_copy_ctr);
+ //  if (_checkcast_array_copy_ctr) st->print_cr("%5u checkcast array copies", _checkcast_array_copy_ctr);
+ //  if (_unsafe_array_copy_ctr)    st->print_cr("%5u unsafe array copies", _unsafe_array_copy_ctr);
+ //  if (_generic_array_copy_ctr)   st->print_cr("%5u generic array copies", _generic_array_copy_ctr);
+ //  if (_slow_array_copy_ctr)      st->print_cr("%5u slow array copies", _slow_array_copy_ctr);
+ //  if (_find_handler_ctr)         st->print_cr("%5u find exception handler", _find_handler_ctr);
+ //  if (_rethrow_ctr)              st->print_cr("%5u rethrow handler", _rethrow_ctr);
+ //}
+ 
  inline double percent(int64_t x, int64_t y) {
    return 100.0 * (double)x / (double)MAX2(y, (int64_t)1);
  }
  
  class MethodArityHistogram {

*** 2076,11 ***
  uint64_t MethodArityHistogram::_total_compiled_calls;
  uint64_t MethodArityHistogram::_max_compiled_calls_per_method;
  int MethodArityHistogram::_max_arity;
  int MethodArityHistogram::_max_size;
  
! void SharedRuntime::print_call_statistics(uint64_t comp_total) {
    tty->print_cr("Calls from compiled code:");
    int64_t total  = _nof_normal_calls + _nof_interface_calls + _nof_static_calls;
    int64_t mono_c = _nof_normal_calls - _nof_megamorphic_calls;
    int64_t mono_i = _nof_interface_calls;
    tty->print_cr("\t" INT64_FORMAT_W(12) " (100%%)  total non-inlined   ", total);
--- 2162,11 ---
  uint64_t MethodArityHistogram::_total_compiled_calls;
  uint64_t MethodArityHistogram::_max_compiled_calls_per_method;
  int MethodArityHistogram::_max_arity;
  int MethodArityHistogram::_max_size;
  
! void SharedRuntime::print_call_statistics_on(outputStream* st) {
    tty->print_cr("Calls from compiled code:");
    int64_t total  = _nof_normal_calls + _nof_interface_calls + _nof_static_calls;
    int64_t mono_c = _nof_normal_calls - _nof_megamorphic_calls;
    int64_t mono_i = _nof_interface_calls;
    tty->print_cr("\t" INT64_FORMAT_W(12) " (100%%)  total non-inlined   ", total);

*** 2329,22 ***
    }
    return nullptr;
  }
  
  #ifndef PRODUCT
! static void print_table_statistics() {
    auto size = [&] (AdapterFingerPrint* key, AdapterHandlerEntry* a) {
      return sizeof(*key) + sizeof(*a);
    };
    TableStatistics ts = _adapter_handler_table->statistics_calculate(size);
!   ts.print(tty, "AdapterHandlerTable");
!   tty->print_cr("AdapterHandlerTable (table_size=%d, entries=%d)",
!                 _adapter_handler_table->table_size(), _adapter_handler_table->number_of_entries());
!   tty->print_cr("AdapterHandlerTable: lookups %d equals %d hits %d compact %d",
!                 _lookups, _equals, _hits, _compact);
  }
! #endif
  
  // ---------------------------------------------------------------------------
  // Implementation of AdapterHandlerLibrary
  AdapterHandlerEntry* AdapterHandlerLibrary::_abstract_method_handler = nullptr;
  AdapterHandlerEntry* AdapterHandlerLibrary::_no_arg_handler = nullptr;
--- 2415,22 ---
    }
    return nullptr;
  }
  
  #ifndef PRODUCT
! void AdapterHandlerLibrary::print_statistics_on(outputStream* st) {
    auto size = [&] (AdapterFingerPrint* key, AdapterHandlerEntry* a) {
      return sizeof(*key) + sizeof(*a);
    };
    TableStatistics ts = _adapter_handler_table->statistics_calculate(size);
!   ts.print(st, "AdapterHandlerTable");
!   st->print_cr("AdapterHandlerTable (table_size=%d, entries=%d)",
!                _adapter_handler_table->table_size(), _adapter_handler_table->number_of_entries());
!   st->print_cr("AdapterHandlerTable: lookups %d equals %d hits %d compact %d",
!                _lookups, _equals, _hits, _compact);
  }
! #endif // !PRODUCT
  
  // ---------------------------------------------------------------------------
  // Implementation of AdapterHandlerLibrary
  AdapterHandlerEntry* AdapterHandlerLibrary::_abstract_method_handler = nullptr;
  AdapterHandlerEntry* AdapterHandlerLibrary::_no_arg_handler = nullptr;

*** 2574,10 ***
--- 2660,13 ---
  
  AdapterHandlerEntry* AdapterHandlerLibrary::create_adapter(AdapterBlob*& new_adapter,
                                                             int total_args_passed,
                                                             BasicType* sig_bt,
                                                             bool allocate_code_blob) {
+   if (UsePerfData) {
+     ClassLoader::perf_method_adapters_count()->inc();
+   }
  
    // StubRoutines::_final_stubs_code is initialized after this function can be called. As a result,
    // VerifyAdapterCalls and VerifyAdapterSharing can fail if we re-use code that generated prior
    // to all StubRoutines::_final_stubs_code being set. Checks refer to runtime range checks generated
    // in an I2C stub that ensure that an I2C stub is called from an interpreter frame or stubs.

*** 2785,11 ***
            if (nm->make_in_use()) {
              method->set_code(method, nm);
            }
          }
  
!         DirectiveSet* directive = DirectivesStack::getDefaultDirective(CompileBroker::compiler(CompLevel_simple));
          if (directive->PrintAssemblyOption) {
            nm->print_code();
          }
          DirectivesStack::release(directive);
        }
--- 2874,11 ---
            if (nm->make_in_use()) {
              method->set_code(method, nm);
            }
          }
  
!         DirectiveSet* directive = DirectivesStack::getMatchingDirective(method, CompileBroker::compiler(CompLevel_simple));
          if (directive->PrintAssemblyOption) {
            nm->print_code();
          }
          DirectivesStack::release(directive);
        }

*** 3023,18 ***
      st->print(" c2iNCI: " INTPTR_FORMAT, p2i(get_c2i_no_clinit_check_entry()));
    }
    st->cr();
  }
  
- #ifndef PRODUCT
- 
- void AdapterHandlerLibrary::print_statistics() {
-   print_table_statistics();
- }
- 
- #endif /* PRODUCT */
- 
  JRT_LEAF(void, SharedRuntime::enable_stack_reserved_zone(JavaThread* current))
    assert(current == JavaThread::current(), "pre-condition");
    StackOverflow* overflow_state = current->stack_overflow_state();
    overflow_state->enable_stack_reserved_zone(/*check_if_disabled*/true);
    overflow_state->set_reserved_stack_activation(current->stack_base());
--- 3112,10 ---
< prev index next >