8058184: Move _highest_comp_level and _highest_osr_comp_level from MethodData to MethodCounters
authoriveresov
Thu, 11 Sep 2014 00:04:50 -0700
changeset 26586 992efa57514f
parent 26585 2048b8d90c91
child 26588 b14c202acbe6
8058184: Move _highest_comp_level and _highest_osr_comp_level from MethodData to MethodCounters Summary: Tiered policy requires highest compilation levels always available Reviewed-by: kvn, vlivanov
hotspot/src/share/vm/oops/method.cpp
hotspot/src/share/vm/oops/methodCounters.cpp
hotspot/src/share/vm/oops/methodCounters.hpp
hotspot/src/share/vm/oops/methodData.cpp
hotspot/src/share/vm/oops/methodData.hpp
--- a/hotspot/src/share/vm/oops/method.cpp	Wed Sep 10 19:08:17 2014 -0700
+++ b/hotspot/src/share/vm/oops/method.cpp	Thu Sep 11 00:04:50 2014 -0700
@@ -1635,34 +1635,34 @@
 }
 
 int Method::highest_comp_level() const {
-  const MethodData* mdo = method_data();
-  if (mdo != NULL) {
-    return mdo->highest_comp_level();
+  const MethodCounters* mcs = method_counters();
+  if (mcs != NULL) {
+    return mcs->highest_comp_level();
   } else {
     return CompLevel_none;
   }
 }
 
 int Method::highest_osr_comp_level() const {
-  const MethodData* mdo = method_data();
-  if (mdo != NULL) {
-    return mdo->highest_osr_comp_level();
+  const MethodCounters* mcs = method_counters();
+  if (mcs != NULL) {
+    return mcs->highest_osr_comp_level();
   } else {
     return CompLevel_none;
   }
 }
 
 void Method::set_highest_comp_level(int level) {
-  MethodData* mdo = method_data();
-  if (mdo != NULL) {
-    mdo->set_highest_comp_level(level);
+  MethodCounters* mcs = method_counters();
+  if (mcs != NULL) {
+    mcs->set_highest_comp_level(level);
   }
 }
 
 void Method::set_highest_osr_comp_level(int level) {
-  MethodData* mdo = method_data();
-  if (mdo != NULL) {
-    mdo->set_highest_osr_comp_level(level);
+  MethodCounters* mcs = method_counters();
+  if (mcs != NULL) {
+    mcs->set_highest_osr_comp_level(level);
   }
 }
 
--- a/hotspot/src/share/vm/oops/methodCounters.cpp	Wed Sep 10 19:08:17 2014 -0700
+++ b/hotspot/src/share/vm/oops/methodCounters.cpp	Thu Sep 11 00:04:50 2014 -0700
@@ -35,4 +35,40 @@
   set_interpreter_throwout_count(0);
   set_interpreter_invocation_count(0);
   set_nmethod_age(INT_MAX);
+#ifdef TIERED
+  set_prev_time(0);
+  set_rate(0);
+  set_highest_comp_level(0);
+  set_highest_osr_comp_level(0);
+#endif
 }
+
+
+int MethodCounters::highest_comp_level() const {
+#ifdef TIERED
+  return _highest_comp_level;
+#else
+  return CompLevel_none;
+#endif
+}
+
+void MethodCounters::set_highest_comp_level(int level) {
+#ifdef TIERED
+  _highest_comp_level = level;
+#endif
+}
+
+int MethodCounters::highest_osr_comp_level() const {
+#ifdef TIERED
+  return _highest_osr_comp_level;
+#else
+  return CompLevel_none;
+#endif
+}
+
+void MethodCounters::set_highest_osr_comp_level(int level) {
+#ifdef TIERED
+  _highest_osr_comp_level = level;
+#endif
+}
+
--- a/hotspot/src/share/vm/oops/methodCounters.hpp	Wed Sep 10 19:08:17 2014 -0700
+++ b/hotspot/src/share/vm/oops/methodCounters.hpp	Thu Sep 11 00:04:50 2014 -0700
@@ -49,6 +49,8 @@
 #ifdef TIERED
   float             _rate;                        // Events (invocation and backedge counter increments) per millisecond
   jlong             _prev_time;                   // Previous time the rate was acquired
+  u1                _highest_comp_level;          // Highest compile level this method has ever seen.
+  u1                _highest_osr_comp_level;      // Same for OSR level
 #endif
 
   MethodCounters() : _interpreter_invocation_count(0),
@@ -57,7 +59,9 @@
                      _nmethod_age(INT_MAX)
 #ifdef TIERED
                    , _rate(0),
-                     _prev_time(0)
+                     _prev_time(0),
+                     _highest_comp_level(0),
+                     _highest_osr_comp_level(0)
 #endif
   {
     invocation_counter()->init();
@@ -114,6 +118,11 @@
   void set_rate(float rate)                      { _rate = rate; }
 #endif
 
+  int highest_comp_level() const;
+  void set_highest_comp_level(int level);
+  int highest_osr_comp_level() const;
+  void set_highest_osr_comp_level(int level);
+
   // invocation counter
   InvocationCounter* invocation_counter() { return &_invocation_counter; }
   InvocationCounter* backedge_counter()   { return &_backedge_counter; }
--- a/hotspot/src/share/vm/oops/methodData.cpp	Wed Sep 10 19:08:17 2014 -0700
+++ b/hotspot/src/share/vm/oops/methodData.cpp	Thu Sep 11 00:04:50 2014 -0700
@@ -1134,8 +1134,6 @@
   _tenure_traps = 0;
   _num_loops = 0;
   _num_blocks = 0;
-  _highest_comp_level = 0;
-  _highest_osr_comp_level = 0;
   _would_profile = true;
 
 #if INCLUDE_RTM_OPT
--- a/hotspot/src/share/vm/oops/methodData.hpp	Wed Sep 10 19:08:17 2014 -0700
+++ b/hotspot/src/share/vm/oops/methodData.hpp	Thu Sep 11 00:04:50 2014 -0700
@@ -2095,10 +2095,6 @@
   // time with C1. It is used to determine if method is trivial.
   short             _num_loops;
   short             _num_blocks;
-  // Highest compile level this method has ever seen.
-  u1                _highest_comp_level;
-  // Same for OSR level
-  u1                _highest_osr_comp_level;
   // Does this method contain anything worth profiling?
   bool              _would_profile;
 
@@ -2277,11 +2273,6 @@
   void set_would_profile(bool p)              { _would_profile = p;    }
   bool would_profile() const                  { return _would_profile; }
 
-  int highest_comp_level() const              { return _highest_comp_level;      }
-  void set_highest_comp_level(int level)      { _highest_comp_level = level;     }
-  int highest_osr_comp_level() const          { return _highest_osr_comp_level;  }
-  void set_highest_osr_comp_level(int level)  { _highest_osr_comp_level = level; }
-
   int num_loops() const                       { return _num_loops;  }
   void set_num_loops(int n)                   { _num_loops = n;     }
   int num_blocks() const                      { return _num_blocks; }