Skip to content

Commit c094d7e

Browse files
committed
8317677: Specialize Vtablestubs::entry_for() for VtableBlob
Backport-of: 1082c0e767a5060d1969edc5ef16f9974e799960
1 parent 0839687 commit c094d7e

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

src/hotspot/share/code/compiledIC.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -561,15 +561,14 @@ void CompiledIC::compute_monomorphic_entry(const methodHandle& method,
561561

562562
bool CompiledIC::is_icholder_entry(address entry) {
563563
CodeBlob* cb = CodeCache::find_blob(entry);
564-
if (cb != nullptr && cb->is_adapter_blob()) {
565-
return true;
564+
if (cb == nullptr) {
565+
return false;
566566
}
567-
// itable stubs also use CompiledICHolder
568-
if (cb != nullptr && cb->is_vtable_blob()) {
569-
VtableStub* s = VtableStubs::entry_point(entry);
570-
return (s != nullptr) && s->is_itable_stub();
567+
if (cb->is_adapter_blob()) {
568+
return true;
569+
} else if (cb->is_vtable_blob()) {
570+
return VtableStubs::is_icholder_entry(entry);
571571
}
572-
573572
return false;
574573
}
575574

src/hotspot/share/code/vtableStubs.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,13 @@ VtableStub* VtableStubs::entry_point(address pc) {
284284
return (s == stub) ? s : nullptr;
285285
}
286286

287+
bool VtableStubs::is_icholder_entry(address pc) {
288+
assert(contains(pc), "must contain all vtable blobs");
289+
VtableStub* stub = (VtableStub*)(pc - VtableStub::entry_offset());
290+
// itable stubs use CompiledICHolder.
291+
return stub->is_itable_stub();
292+
}
293+
287294
bool VtableStubs::contains(address pc) {
288295
// simple solution for now - we may want to use
289296
// a faster way if this function is called often

src/hotspot/share/code/vtableStubs.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ class VtableStubs : AllStatic {
105105
static address find_itable_stub(int itable_index) { return find_stub(false, itable_index); }
106106

107107
static VtableStub* entry_point(address pc); // vtable stub entry point for a pc
108+
static bool is_icholder_entry(address pc); // is the blob containing pc (which must be a vtable blob) an icholder?
108109
static bool contains(address pc); // is pc within any stub?
109110
static VtableStub* stub_containing(address pc); // stub containing pc or nullptr
110111
static int number_of_vtable_stubs() { return _number_of_vtable_stubs; }

0 commit comments

Comments
 (0)