Skip to content

Commit b1b4828

Browse files
committed
8350086: Inline hot Method accessors for faster task selection
Reviewed-by: kvn, coleenp, aph, vlivanov
1 parent 5e9d72e commit b1b4828

File tree

6 files changed

+46
-38
lines changed

6 files changed

+46
-38
lines changed

src/hotspot/share/compiler/compileTask.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include "logging/logStream.hpp"
3232
#include "memory/resourceArea.hpp"
3333
#include "oops/klass.inline.hpp"
34+
#include "oops/method.inline.hpp"
3435
#include "runtime/handles.inline.hpp"
3536
#include "runtime/jniHandles.hpp"
3637
#include "runtime/mutexLocker.hpp"

src/hotspot/share/oops/method.cpp

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1919,39 +1919,6 @@ void Method::clear_all_breakpoints() {
19191919

19201920
#endif // INCLUDE_JVMTI
19211921

1922-
int Method::invocation_count() const {
1923-
MethodCounters* mcs = method_counters();
1924-
MethodData* mdo = method_data();
1925-
if (((mcs != nullptr) ? mcs->invocation_counter()->carry() : false) ||
1926-
((mdo != nullptr) ? mdo->invocation_counter()->carry() : false)) {
1927-
return InvocationCounter::count_limit;
1928-
} else {
1929-
return ((mcs != nullptr) ? mcs->invocation_counter()->count() : 0) +
1930-
((mdo != nullptr) ? mdo->invocation_counter()->count() : 0);
1931-
}
1932-
}
1933-
1934-
int Method::backedge_count() const {
1935-
MethodCounters* mcs = method_counters();
1936-
MethodData* mdo = method_data();
1937-
if (((mcs != nullptr) ? mcs->backedge_counter()->carry() : false) ||
1938-
((mdo != nullptr) ? mdo->backedge_counter()->carry() : false)) {
1939-
return InvocationCounter::count_limit;
1940-
} else {
1941-
return ((mcs != nullptr) ? mcs->backedge_counter()->count() : 0) +
1942-
((mdo != nullptr) ? mdo->backedge_counter()->count() : 0);
1943-
}
1944-
}
1945-
1946-
int Method::highest_comp_level() const {
1947-
const MethodCounters* mcs = method_counters();
1948-
if (mcs != nullptr) {
1949-
return mcs->highest_comp_level();
1950-
} else {
1951-
return CompLevel_none;
1952-
}
1953-
}
1954-
19551922
int Method::highest_osr_comp_level() const {
19561923
const MethodCounters* mcs = method_counters();
19571924
if (mcs != nullptr) {

src/hotspot/share/oops/method.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ class Method : public Metadata {
255255
void set_deprecated_for_removal() { constMethod()->set_deprecated_for_removal(); }
256256
bool deprecated_for_removal() const { return constMethod()->deprecated_for_removal(); }
257257

258-
int highest_comp_level() const;
258+
inline int highest_comp_level() const;
259259
void set_highest_comp_level(int level);
260260
int highest_osr_comp_level() const;
261261
void set_highest_osr_comp_level(int level);
@@ -334,8 +334,8 @@ class Method : public Metadata {
334334
inline float rate() const;
335335
inline void set_rate(float rate);
336336

337-
int invocation_count() const;
338-
int backedge_count() const;
337+
inline int invocation_count() const;
338+
inline int backedge_count() const;
339339

340340
bool was_executed_more_than(int n);
341341
bool was_never_executed() { return !was_executed_more_than(0); }
@@ -344,7 +344,7 @@ class Method : public Metadata {
344344

345345
static MethodCounters* build_method_counters(Thread* current, Method* m);
346346

347-
int interpreter_invocation_count() { return invocation_count(); }
347+
inline int interpreter_invocation_count() const;
348348

349349
#ifndef PRODUCT
350350
int64_t compiled_invocation_count() const { return _compiled_invocation_count;}

src/hotspot/share/oops/method.inline.hpp

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@
2828
#include "oops/method.hpp"
2929

3030
#include "classfile/vmIntrinsics.hpp"
31+
#include "code/nmethod.inline.hpp"
3132
#include "oops/methodCounters.hpp"
33+
#include "oops/methodData.inline.hpp"
3234
#include "runtime/atomic.hpp"
3335

3436
inline address Method::from_compiled_entry() const {
@@ -188,4 +190,41 @@ inline void Method::set_rate(float rate) {
188190
}
189191
}
190192

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+
191230
#endif // SHARE_OOPS_METHOD_INLINE_HPP

src/hotspot/share/oops/methodData.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include "memory/metaspaceClosure.hpp"
3434
#include "memory/resourceArea.hpp"
3535
#include "oops/klass.inline.hpp"
36+
#include "oops/method.inline.hpp"
3637
#include "oops/methodData.inline.hpp"
3738
#include "prims/jvmtiRedefineClasses.hpp"
3839
#include "runtime/atomic.hpp"

src/hotspot/share/runtime/java.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
#include "oops/instanceKlass.hpp"
5555
#include "oops/instanceOop.hpp"
5656
#include "oops/klassVtable.hpp"
57-
#include "oops/method.hpp"
57+
#include "oops/method.inline.hpp"
5858
#include "oops/objArrayOop.hpp"
5959
#include "oops/oop.inline.hpp"
6060
#include "oops/symbol.hpp"

0 commit comments

Comments
 (0)