diff --git a/src/share/vm/oops/method.cpp b/src/share/vm/oops/method.cpp index 0ccf432252b6fbbaaf9a5f7022ef26a63df53492..38af48a48c4fe8b744cf93b7c8dc211f548e97e6 100644 --- a/src/share/vm/oops/method.cpp +++ b/src/share/vm/oops/method.cpp @@ -1636,34 +1636,34 @@ int Method::backedge_count() { } 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); } } diff --git a/src/share/vm/oops/methodCounters.cpp b/src/share/vm/oops/methodCounters.cpp index 1ee8eb17001cb6145afb822f005281752a591d08..6053dfd64f49c460e67563918a6c3ced6765fc5f 100644 --- a/src/share/vm/oops/methodCounters.cpp +++ b/src/share/vm/oops/methodCounters.cpp @@ -34,4 +34,40 @@ void MethodCounters::clear_counters() { backedge_counter()->reset(); set_interpreter_throwout_count(0); set_interpreter_invocation_count(0); +#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 +} + diff --git a/src/share/vm/oops/methodCounters.hpp b/src/share/vm/oops/methodCounters.hpp index 0a6c895b328d42ad3f30e39a34fabd5a06ca2a5a..b986445747477a61c2bca93cbc3f1494e1f3398b 100644 --- a/src/share/vm/oops/methodCounters.hpp +++ b/src/share/vm/oops/methodCounters.hpp @@ -39,6 +39,8 @@ class MethodCounters: public MetaspaceObj { #ifdef TIERED float _rate; // Events (invocation and backedge counter increments) per millisecond + u1 _highest_comp_level; // Highest compile level this method has ever seen. + u1 _highest_osr_comp_level; // Same for OSR level jlong _prev_time; // Previous time the rate was acquired #endif @@ -47,6 +49,8 @@ class MethodCounters: public MetaspaceObj { _number_of_breakpoints(0) #ifdef TIERED , _rate(0), + _highest_comp_level(0), + _highest_osr_comp_level(0), _prev_time(0) #endif { @@ -100,6 +104,11 @@ class MethodCounters: public MetaspaceObj { 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; } diff --git a/src/share/vm/oops/methodData.cpp b/src/share/vm/oops/methodData.cpp index 1d7d73a9874b277fb1370d8467d1006e8e7859d8..16cd134788595d29ea18be3f56a6c63308fdae44 100644 --- a/src/share/vm/oops/methodData.cpp +++ b/src/share/vm/oops/methodData.cpp @@ -1153,8 +1153,6 @@ void MethodData::init() { _backedge_counter_start = 0; _num_loops = 0; _num_blocks = 0; - _highest_comp_level = 0; - _highest_osr_comp_level = 0; _would_profile = true; #if INCLUDE_RTM_OPT diff --git a/src/share/vm/oops/methodData.hpp b/src/share/vm/oops/methodData.hpp index 0a4c769aaef82376880e5bbd283be70f3ff41ed9..7896c97858da1d0eb5ea5273a5324f5ab79ec00e 100644 --- a/src/share/vm/oops/methodData.hpp +++ b/src/share/vm/oops/methodData.hpp @@ -2098,10 +2098,6 @@ private: // 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; @@ -2275,11 +2271,6 @@ public: 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; }