< prev index next >

src/hotspot/share/oops/methodCounters.hpp

Print this page
@@ -29,34 +29,51 @@
  #include "compiler/compilerDefinitions.hpp"
  #include "compiler/compilerOracle.hpp"
  #include "interpreter/invocationCounter.hpp"
  #include "utilities/align.hpp"
  
+ class MethodTrainingData;
+ 
  class MethodCounters : public Metadata {
   friend class VMStructs;
   friend class JVMCIVMStructs;
+ 
+  // Used by CDS. These classes need to access the private default constructor.
+  template <class T> friend class CppVtableTesterA;
+  template <class T> friend class CppVtableTesterB;
+  template <class T> friend class CppVtableCloner;
+ 
   private:
-   InvocationCounter _invocation_counter;         // Incremented before each activation of the method - used to trigger frequency-based optimizations
-   InvocationCounter _backedge_counter;           // Incremented before each backedge taken - used to trigger frequency-based optimizations
-   jlong             _prev_time;                   // Previous time the rate was acquired
-   float             _rate;                        // Events (invocation and backedge counter increments) per millisecond
-   int               _invoke_mask;                 // per-method Tier0InvokeNotifyFreqLog
-   int               _backedge_mask;               // per-method Tier0BackedgeNotifyFreqLog
-   int               _prev_event_count;            // Total number of events saved at previous callback
+   InvocationCounter   _invocation_counter;         // Incremented before each activation of the method - used to trigger frequency-based optimizations
+   InvocationCounter   _backedge_counter;           // Incremented before each backedge taken - used to trigger frequency-based optimizations
+ 
+   // Back pointer to the Method*
+   Method* _method;
+ 
+   MethodTrainingData* _method_training_data;
+   jlong               _prev_time;                   // Previous time the rate was acquired
+   float               _rate;                        // Events (invocation and backedge counter increments) per millisecond
+   int                 _invoke_mask;                 // per-method Tier0InvokeNotifyFreqLog
+   int                 _backedge_mask;               // per-method Tier0BackedgeNotifyFreqLog
+   int                 _prev_event_count;            // Total number of events saved at previous callback
  #if COMPILER2_OR_JVMCI
-   u2                _interpreter_throwout_count; // Count of times method was exited via exception while interpreting
+   u2                  _interpreter_throwout_count; // Count of times method was exited via exception while interpreting
  #endif
  #if INCLUDE_JVMTI
-   u2                _number_of_breakpoints;      // fullspeed debugging support
+   u2                  _number_of_breakpoints;      // fullspeed debugging support
  #endif
-   u1                _highest_comp_level;          // Highest compile level this method has ever seen.
-   u1                _highest_osr_comp_level;      // Same for OSR level
+   u1                  _highest_comp_level;          // Highest compile level this method has ever seen.
+   u1                  _highest_osr_comp_level;      // Same for OSR level
  
    MethodCounters(const methodHandle& mh);
+   MethodCounters();
+ 
   public:
    virtual bool is_methodCounters() const { return true; }
  
+   Method* method() const { return _method; }
+ 
    static MethodCounters* allocate_no_exception(const methodHandle& mh);
    static MethodCounters* allocate_with_exception(const methodHandle& mh, TRAPS);
  
    void deallocate_contents(ClassLoaderData* loader_data) {}
  

@@ -65,10 +82,12 @@
    }
    virtual int size() const {
      return method_counters_size();
    }
    MetaspaceObj::Type type() const { return MethodCountersType; }
+   virtual void metaspace_pointers_do(MetaspaceClosure* iter);
+ 
    void clear_counters();
  
  #if COMPILER2_OR_JVMCI
    void interpreter_throwout_increment() {
      if (_interpreter_throwout_count < 65534) {

@@ -128,9 +147,23 @@
    static ByteSize backedge_mask_offset() {
      return byte_offset_of(MethodCounters, _backedge_mask);
    }
  
    virtual const char* internal_name() const { return "{method counters}"; }
-   virtual void print_value_on(outputStream* st) const;
  
+   MethodTrainingData* method_training_data() const { return _method_training_data; }
+   bool init_method_training_data(MethodTrainingData* tdata) {
+     return (_method_training_data == tdata ||
+             Atomic::replace_if_null(&_method_training_data, tdata));
+   }
+ 
+ #if INCLUDE_CDS
+   void remove_unshareable_info();
+   void restore_unshareable_info(TRAPS);
+ #endif
+ 
+   // Printing
+   void print_on      (outputStream* st) const;
+   void print_value_on(outputStream* st) const;
+   void print_data_on(outputStream* st) const;
  };
  #endif // SHARE_OOPS_METHODCOUNTERS_HPP
< prev index next >