|
28 | 28 | #include "oops/method.hpp" |
29 | 29 |
|
30 | 30 | #include "classfile/vmIntrinsics.hpp" |
| 31 | +#include "code/nmethod.inline.hpp" |
31 | 32 | #include "oops/methodCounters.hpp" |
| 33 | +#include "oops/methodData.inline.hpp" |
32 | 34 | #include "runtime/atomic.hpp" |
33 | 35 |
|
34 | 36 | inline address Method::from_compiled_entry() const { |
@@ -188,4 +190,41 @@ inline void Method::set_rate(float rate) { |
188 | 190 | } |
189 | 191 | } |
190 | 192 |
|
| 193 | +inline int Method::invocation_count() const { |
| 194 | + MethodCounters* mcs = method_counters(); |
| 195 | + MethodData* mdo = method_data(); |
| 196 | + if (((mcs != nullptr) ? mcs->invocation_counter()->carry() : false) || |
| 197 | + ((mdo != nullptr) ? mdo->invocation_counter()->carry() : false)) { |
| 198 | + return InvocationCounter::count_limit; |
| 199 | + } else { |
| 200 | + return ((mcs != nullptr) ? mcs->invocation_counter()->count() : 0) + |
| 201 | + ((mdo != nullptr) ? mdo->invocation_counter()->count() : 0); |
| 202 | + } |
| 203 | +} |
| 204 | + |
| 205 | +inline int Method::backedge_count() const { |
| 206 | + MethodCounters* mcs = method_counters(); |
| 207 | + MethodData* mdo = method_data(); |
| 208 | + if (((mcs != nullptr) ? mcs->backedge_counter()->carry() : false) || |
| 209 | + ((mdo != nullptr) ? mdo->backedge_counter()->carry() : false)) { |
| 210 | + return InvocationCounter::count_limit; |
| 211 | + } else { |
| 212 | + return ((mcs != nullptr) ? mcs->backedge_counter()->count() : 0) + |
| 213 | + ((mdo != nullptr) ? mdo->backedge_counter()->count() : 0); |
| 214 | + } |
| 215 | +} |
| 216 | + |
| 217 | +inline int Method::highest_comp_level() const { |
| 218 | + const MethodCounters* mcs = method_counters(); |
| 219 | + if (mcs != nullptr) { |
| 220 | + return mcs->highest_comp_level(); |
| 221 | + } else { |
| 222 | + return CompLevel_none; |
| 223 | + } |
| 224 | +} |
| 225 | + |
| 226 | +inline int Method::interpreter_invocation_count() const { |
| 227 | + return invocation_count(); |
| 228 | +} |
| 229 | + |
191 | 230 | #endif // SHARE_OOPS_METHOD_INLINE_HPP |
0 commit comments