< prev index next >

src/hotspot/share/oops/methodCounters.cpp

Print this page
@@ -21,10 +21,11 @@
   * questions.
   *
   */
  
  #include "cds/cdsConfig.hpp"
+ #include "code/aotCodeCache.hpp"
  #include "compiler/compiler_globals.hpp"
  #include "compiler/compilerOracle.hpp"
  #include "memory/metaspaceClosure.hpp"
  #include "memory/resourceArea.hpp"
  #include "oops/method.hpp"

@@ -38,10 +39,14 @@
    _prev_time(0),
    _rate(0),
    _highest_comp_level(0),
    _highest_osr_comp_level(0)
  {
+ #if INCLUDE_CDS
+   set_aot_code_invocation_count(0);
+   set_aot_preload_code_entry(nullptr);
+ #endif
    set_interpreter_throwout_count(0);
    JVMTI_ONLY(clear_number_of_breakpoints());
    invocation_counter()->init();
    backedge_counter()->init();
  

@@ -71,25 +76,46 @@
  }
  
  void MethodCounters::clear_counters() {
    invocation_counter()->reset();
    backedge_counter()->reset();
+ #if INCLUDE_CDS
+   set_aot_code_invocation_count(0);
+   if (aot_preload_code_entry() != nullptr) {
+     AOTCodeCache::invalidate(aot_preload_code_entry());
+     set_aot_preload_code_entry(nullptr);
+   }
+ #endif
    set_interpreter_throwout_count(0);
    set_prev_time(0);
    set_prev_event_count(0);
    set_rate(0);
    set_highest_comp_level(0);
    set_highest_osr_comp_level(0);
  }
  
+ #if INCLUDE_CDS
+ void MethodCounters::deallocate_contents(ClassLoaderData* loader_data) {
+   if (aot_preload_code_entry() != nullptr) {
+     AOTCodeCache::invalidate(aot_preload_code_entry());
+     set_aot_preload_code_entry(nullptr);
+   }
+ }
+ #endif
+ 
  void MethodCounters::metaspace_pointers_do(MetaspaceClosure* it) {
    log_trace(aot, training)("Iter(MethodCounters): %p", this);
    it->push(&_method);
    it->push(&_method_training_data);
  }
  
  #if INCLUDE_CDS
+ void MethodCounters::set_aot_preload_code_entry(AOTCodeEntry* entry) {
+   precond(entry == nullptr || entry->for_preload());
+   _aot_preload_code_entry = entry;
+ }
+ 
  void MethodCounters::remove_unshareable_info() {
  }
  void MethodCounters::restore_unshareable_info(TRAPS) {
    _method_training_data = method_training_data_sentinel();
  }
< prev index next >