Skip to content

Commit

Permalink
8317677: Specialize Vtablestubs::entry_for() for VtableBlob
Browse files Browse the repository at this point in the history
Reviewed-by: thartmann, kvn
  • Loading branch information
Thomas Schatzl committed Oct 13, 2023
1 parent ec310fe commit 1082c0e
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 @@ -559,15 +559,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 @@ -106,6 +106,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

3 comments on commit 1082c0e

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

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

@GoeLin
Copy link
Member

@GoeLin GoeLin commented on 1082c0e Apr 2, 2024

Choose a reason for hiding this comment

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

/backport jdk21u-dev

@openjdk
Copy link

@openjdk openjdk bot commented on 1082c0e Apr 2, 2024

Choose a reason for hiding this comment

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

@GoeLin the backport was successfully created on the branch backport-GoeLin-1082c0e7 in my personal fork of openjdk/jdk21u-dev. To create a pull request with this backport targeting openjdk/jdk21u-dev:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit 1082c0e7 from the openjdk/jdk repository.

The commit being backported was authored by Thomas Schatzl on 13 Oct 2023 and was reviewed by Tobias Hartmann and Vladimir Kozlov.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk21u-dev:

$ git fetch https://github.com/openjdk-bots/jdk21u-dev.git backport-GoeLin-1082c0e7:backport-GoeLin-1082c0e7
$ git checkout backport-GoeLin-1082c0e7
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk21u-dev.git backport-GoeLin-1082c0e7

Please sign in to comment.