Skip to content

Commit

Permalink
8317677: Specialize Vtablestubs::entry_for() for VtableBlob
Browse files Browse the repository at this point in the history
Backport-of: 1082c0e767a5060d1969edc5ef16f9974e799960
  • Loading branch information
GoeLin committed Apr 3, 2024
1 parent 0839687 commit c094d7e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/hotspot/share/code/compiledIC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -561,15 +561,14 @@ void CompiledIC::compute_monomorphic_entry(const methodHandle& method,

bool CompiledIC::is_icholder_entry(address entry) {
CodeBlob* cb = CodeCache::find_blob(entry);
if (cb != nullptr && cb->is_adapter_blob()) {
return true;
if (cb == nullptr) {
return false;
}
// itable stubs also use CompiledICHolder
if (cb != nullptr && cb->is_vtable_blob()) {
VtableStub* s = VtableStubs::entry_point(entry);
return (s != nullptr) && s->is_itable_stub();
if (cb->is_adapter_blob()) {
return true;
} else if (cb->is_vtable_blob()) {
return VtableStubs::is_icholder_entry(entry);
}

return false;
}

Expand Down
7 changes: 7 additions & 0 deletions src/hotspot/share/code/vtableStubs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,13 @@ VtableStub* VtableStubs::entry_point(address pc) {
return (s == stub) ? s : nullptr;
}

bool VtableStubs::is_icholder_entry(address pc) {
assert(contains(pc), "must contain all vtable blobs");
VtableStub* stub = (VtableStub*)(pc - VtableStub::entry_offset());
// itable stubs use CompiledICHolder.
return stub->is_itable_stub();
}

bool VtableStubs::contains(address pc) {
// simple solution for now - we may want to use
// a faster way if this function is called often
Expand Down
1 change: 1 addition & 0 deletions src/hotspot/share/code/vtableStubs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ class VtableStubs : AllStatic {
static address find_itable_stub(int itable_index) { return find_stub(false, itable_index); }

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

1 comment on commit c094d7e

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.