8317677: Specialize Vtablestubs::entry_for() for VtableBlob

Reviewed-by: thartmann, kvn
This commit is contained in:
Thomas Schatzl 2023-10-13 07:40:00 +00:00
parent ec310fe809
commit 1082c0e767
3 changed files with 14 additions and 7 deletions

@ -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()) {
if (cb == nullptr) {
return false;
}
if (cb->is_adapter_blob()) {
return true;
} else if (cb->is_vtable_blob()) {
return VtableStubs::is_icholder_entry(entry);
}
// 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();
}
return false;
}

@ -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

@ -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; }