src/share/vm/oops/methodCounters.hpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hs-comp2 Sdiff src/share/vm/oops

src/share/vm/oops/methodCounters.hpp

Print this page




  32  friend class VMStructs;
  33  private:
  34   int               _interpreter_invocation_count; // Count of times invoked (reused as prev_event_count in tiered)
  35   u2                _interpreter_throwout_count; // Count of times method was exited via exception while interpreting
  36   u2                _number_of_breakpoints;      // fullspeed debugging support
  37   InvocationCounter _invocation_counter;         // Incremented before each activation of the method - used to trigger frequency-based optimizations
  38   InvocationCounter _backedge_counter;           // Incremented before each backedge taken - used to trigger frequencey-based optimizations
  39   // NMethod age is a counter for warm methods detection in the code cache sweeper.
  40   // The counter is reset by the sweeper and is decremented by some of the compiled
  41   // code. The counter values are interpreted as follows:
  42   // 1. (HotMethodDetection..INT_MAX] - initial value, no counters inserted
  43   // 2. (1..HotMethodDetectionLimit)  - the method is warm, the counter is used
  44   //                                    to figure out which methods can be flushed.
  45   // 3. (INT_MIN..0]                  - method is hot and will deopt and get
  46   //                                    recompiled without the counters
  47   int               _nmethod_age;
  48 
  49 #ifdef TIERED
  50   float             _rate;                        // Events (invocation and backedge counter increments) per millisecond
  51   jlong             _prev_time;                   // Previous time the rate was acquired


  52 #endif
  53 
  54   MethodCounters() : _interpreter_invocation_count(0),
  55                      _interpreter_throwout_count(0),
  56                      _number_of_breakpoints(0),
  57                      _nmethod_age(INT_MAX)
  58 #ifdef TIERED
  59                    , _rate(0),
  60                      _prev_time(0)


  61 #endif
  62   {
  63     invocation_counter()->init();
  64     backedge_counter()->init();
  65 
  66     if (StressCodeAging) {
  67       set_nmethod_age(HotMethodDetectionLimit);
  68     }
  69   }
  70 
  71  public:
  72   static MethodCounters* allocate(ClassLoaderData* loader_data, TRAPS);
  73 
  74   void deallocate_contents(ClassLoaderData* loader_data) {}
  75   DEBUG_ONLY(bool on_stack() { return false; })  // for template
  76 
  77   static int size() { return sizeof(MethodCounters) / wordSize; }
  78 
  79   bool is_klass() const { return false; }
  80 


  97   }
  98   int  interpreter_throwout_count() const {
  99     return _interpreter_throwout_count;
 100   }
 101   void set_interpreter_throwout_count(int count) {
 102     _interpreter_throwout_count = count;
 103   }
 104 
 105   u2   number_of_breakpoints() const   { return _number_of_breakpoints; }
 106   void incr_number_of_breakpoints()    { ++_number_of_breakpoints; }
 107   void decr_number_of_breakpoints()    { --_number_of_breakpoints; }
 108   void clear_number_of_breakpoints()   { _number_of_breakpoints = 0; }
 109 
 110 #ifdef TIERED
 111   jlong prev_time() const                        { return _prev_time; }
 112   void set_prev_time(jlong time)                 { _prev_time = time; }
 113   float rate() const                             { return _rate; }
 114   void set_rate(float rate)                      { _rate = rate; }
 115 #endif
 116 





 117   // invocation counter
 118   InvocationCounter* invocation_counter() { return &_invocation_counter; }
 119   InvocationCounter* backedge_counter()   { return &_backedge_counter; }
 120 
 121   int nmethod_age() {
 122     return _nmethod_age;
 123   }
 124   void set_nmethod_age(int age) {
 125     _nmethod_age = age;
 126   }
 127   void reset_nmethod_age() {
 128     set_nmethod_age(HotMethodDetectionLimit);
 129   }
 130 
 131   static bool is_nmethod_hot(int age)       { return age <= 0; }
 132   static bool is_nmethod_warm(int age)      { return age < HotMethodDetectionLimit; }
 133   static bool is_nmethod_age_unset(int age) { return age > HotMethodDetectionLimit; }
 134 
 135   static ByteSize nmethod_age_offset() {
 136     return byte_offset_of(MethodCounters, _nmethod_age);


  32  friend class VMStructs;
  33  private:
  34   int               _interpreter_invocation_count; // Count of times invoked (reused as prev_event_count in tiered)
  35   u2                _interpreter_throwout_count; // Count of times method was exited via exception while interpreting
  36   u2                _number_of_breakpoints;      // fullspeed debugging support
  37   InvocationCounter _invocation_counter;         // Incremented before each activation of the method - used to trigger frequency-based optimizations
  38   InvocationCounter _backedge_counter;           // Incremented before each backedge taken - used to trigger frequencey-based optimizations
  39   // NMethod age is a counter for warm methods detection in the code cache sweeper.
  40   // The counter is reset by the sweeper and is decremented by some of the compiled
  41   // code. The counter values are interpreted as follows:
  42   // 1. (HotMethodDetection..INT_MAX] - initial value, no counters inserted
  43   // 2. (1..HotMethodDetectionLimit)  - the method is warm, the counter is used
  44   //                                    to figure out which methods can be flushed.
  45   // 3. (INT_MIN..0]                  - method is hot and will deopt and get
  46   //                                    recompiled without the counters
  47   int               _nmethod_age;
  48 
  49 #ifdef TIERED
  50   float             _rate;                        // Events (invocation and backedge counter increments) per millisecond
  51   jlong             _prev_time;                   // Previous time the rate was acquired
  52   u1                _highest_comp_level;          // Highest compile level this method has ever seen.
  53   u1                _highest_osr_comp_level;      // Same for OSR level
  54 #endif
  55 
  56   MethodCounters() : _interpreter_invocation_count(0),
  57                      _interpreter_throwout_count(0),
  58                      _number_of_breakpoints(0),
  59                      _nmethod_age(INT_MAX)
  60 #ifdef TIERED
  61                    , _rate(0),
  62                      _prev_time(0),
  63                      _highest_comp_level(0),
  64                      _highest_osr_comp_level(0)
  65 #endif
  66   {
  67     invocation_counter()->init();
  68     backedge_counter()->init();
  69 
  70     if (StressCodeAging) {
  71       set_nmethod_age(HotMethodDetectionLimit);
  72     }
  73   }
  74 
  75  public:
  76   static MethodCounters* allocate(ClassLoaderData* loader_data, TRAPS);
  77 
  78   void deallocate_contents(ClassLoaderData* loader_data) {}
  79   DEBUG_ONLY(bool on_stack() { return false; })  // for template
  80 
  81   static int size() { return sizeof(MethodCounters) / wordSize; }
  82 
  83   bool is_klass() const { return false; }
  84 


 101   }
 102   int  interpreter_throwout_count() const {
 103     return _interpreter_throwout_count;
 104   }
 105   void set_interpreter_throwout_count(int count) {
 106     _interpreter_throwout_count = count;
 107   }
 108 
 109   u2   number_of_breakpoints() const   { return _number_of_breakpoints; }
 110   void incr_number_of_breakpoints()    { ++_number_of_breakpoints; }
 111   void decr_number_of_breakpoints()    { --_number_of_breakpoints; }
 112   void clear_number_of_breakpoints()   { _number_of_breakpoints = 0; }
 113 
 114 #ifdef TIERED
 115   jlong prev_time() const                        { return _prev_time; }
 116   void set_prev_time(jlong time)                 { _prev_time = time; }
 117   float rate() const                             { return _rate; }
 118   void set_rate(float rate)                      { _rate = rate; }
 119 #endif
 120 
 121   int highest_comp_level() const;
 122   void set_highest_comp_level(int level);
 123   int highest_osr_comp_level() const;
 124   void set_highest_osr_comp_level(int level);
 125 
 126   // invocation counter
 127   InvocationCounter* invocation_counter() { return &_invocation_counter; }
 128   InvocationCounter* backedge_counter()   { return &_backedge_counter; }
 129 
 130   int nmethod_age() {
 131     return _nmethod_age;
 132   }
 133   void set_nmethod_age(int age) {
 134     _nmethod_age = age;
 135   }
 136   void reset_nmethod_age() {
 137     set_nmethod_age(HotMethodDetectionLimit);
 138   }
 139 
 140   static bool is_nmethod_hot(int age)       { return age <= 0; }
 141   static bool is_nmethod_warm(int age)      { return age < HotMethodDetectionLimit; }
 142   static bool is_nmethod_age_unset(int age) { return age > HotMethodDetectionLimit; }
 143 
 144   static ByteSize nmethod_age_offset() {
 145     return byte_offset_of(MethodCounters, _nmethod_age);
src/share/vm/oops/methodCounters.hpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File