< prev index next >

src/hotspot/share/oops/methodCounters.cpp

Print this page
*** 20,16 ***
   * or visit www.oracle.com if you need additional information or have any
   * questions.
   *
   */
  #include "precompiled.hpp"
  #include "compiler/compiler_globals.hpp"
! #include "oops/method.hpp"
  #include "oops/methodCounters.hpp"
  #include "runtime/handles.inline.hpp"
  
  MethodCounters::MethodCounters(const methodHandle& mh) :
    _prev_time(0),
    _rate(0),
    _highest_comp_level(0),
    _highest_osr_comp_level(0)
  {
--- 20,21 ---
   * or visit www.oracle.com if you need additional information or have any
   * questions.
   *
   */
  #include "precompiled.hpp"
+ #include "cds/cdsConfig.hpp"
  #include "compiler/compiler_globals.hpp"
! #include "memory/metaspaceClosure.hpp"
  #include "oops/methodCounters.hpp"
+ #include "oops/trainingData.hpp"
  #include "runtime/handles.inline.hpp"
+ #include "memory/resourceArea.hpp"
  
  MethodCounters::MethodCounters(const methodHandle& mh) :
+   _method(mh()),
+   _method_training_data(nullptr),
    _prev_time(0),
    _rate(0),
    _highest_comp_level(0),
    _highest_osr_comp_level(0)
  {

*** 44,10 ***
--- 49,14 ---
  
    _invoke_mask = right_n_bits(CompilerConfig::scaled_freq_log(Tier0InvokeNotifyFreqLog, scale)) << InvocationCounter::count_shift;
    _backedge_mask = right_n_bits(CompilerConfig::scaled_freq_log(Tier0BackedgeNotifyFreqLog, scale)) << InvocationCounter::count_shift;
  }
  
+ MethodCounters::MethodCounters() {
+   assert(CDSConfig::is_dumping_static_archive() || UseSharedSpaces, "only for CDS");
+ }
+ 
  MethodCounters* MethodCounters::allocate_no_exception(const methodHandle& mh) {
    ClassLoaderData* loader_data = mh->method_holder()->class_loader_data();
    return new(loader_data, method_counters_size(), MetaspaceObj::MethodCountersType) MethodCounters(mh);
  }
  

*** 65,10 ***
--- 74,50 ---
    set_rate(0);
    set_highest_comp_level(0);
    set_highest_osr_comp_level(0);
  }
  
+ void MethodCounters::metaspace_pointers_do(MetaspaceClosure* it) {
+   log_trace(cds)("Iter(MethodCounters): %p", this);
+   it->push(&_method);
+   it->push(&_method_training_data);
+ }
+ 
+ #if INCLUDE_CDS
+ void MethodCounters::remove_unshareable_info() {
+   _method_training_data = nullptr;
+ }
+ 
+ void MethodCounters::restore_unshareable_info(TRAPS) {
+ }
+ #endif // INCLUDE_CDS
+ 
+ void MethodCounters::print_on(outputStream* st) const {
+   assert(is_methodCounters(), "should be method counters");
+   st->print("method counters");
+   print_data_on(st);
+ }
+ 
+ void MethodCounters::print_data_on(outputStream* st) const {
+   ResourceMark rm;
+   st->print_cr("  - invocation_counter: %d carry=%d", _invocation_counter.count(), _invocation_counter.carry());
+   st->print_cr("  - backedge_counter: %d carry=%d",   _backedge_counter.count(), _backedge_counter.carry());
+   st->print_cr("  - prev_time: " JLONG_FORMAT,        _prev_time);
+   st->print_cr("  - rate: %.3f",             _rate);
+   st->print_cr("  - invoke_mask: %d",        _invoke_mask);
+   st->print_cr("  - backedge_mask: %d",      _backedge_mask);
+   st->print_cr("  - prev_event_count: %d",   _prev_event_count);
+ #if COMPILER2_OR_JVMCI
+   st->print_cr("  - interpreter_throwout_count: %u", _interpreter_throwout_count);
+ #endif
+ #if INCLUDE_JVMTI
+   st->print_cr("  - number_of_breakpoints: %u", _number_of_breakpoints);
+ #endif
+   st->print_cr("  - highest_comp_level: %u", _highest_comp_level);
+   st->print_cr("  - highest_osr_comp_level: %u", _highest_osr_comp_level);
+ }
+ 
  void MethodCounters::print_value_on(outputStream* st) const {
    assert(is_methodCounters(), "must be methodCounters");
    st->print("method counters");
    print_address_on(st);
  }
< prev index next >