Skip to content

Commit

Permalink
Add exhaustive check for method holder availability
Browse files Browse the repository at this point in the history
  • Loading branch information
jbachorik committed Nov 23, 2023
1 parent 9f61d8e commit 00f644a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/hotspot/share/oops/method.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2264,9 +2264,10 @@ void Method::clear_jmethod_ids(ClassLoaderData* loader_data) {
}

void Method::clear_jmethod_id() {
if (method_holder() == nullptr) {
// the method has not been fully initialized and has no link to its holder
if (const_method() != nullptr && constants() != nullptr && method_holder() == nullptr) {
// The method has not been fully initialized and has no link to its holder
// jmethodIDs are kept in the cache in the holder and so, without the holder there is no associated jmethodID
// The holder is resolved via const_method()->constants()->pool_holder() so we must check all parts for nullptr
return;
}
// Being at a safepoint prevents racing against other class redefinitions
Expand Down

0 comments on commit 00f644a

Please sign in to comment.