RFR: 8268364: jmethod clearing should be done during unloading

Coleen Phillimore coleenp at openjdk.java.net
Thu Jul 1 12:24:03 UTC 2021


On Thu, 1 Jul 2021 00:11:55 GMT, Daniel D. Daugherty <dcubed at openjdk.org> wrote:

>> src/hotspot/share/oops/method.cpp line 2261:
>> 
>>> 2259:   }
>>> 2260:   // Method should otherwise be valid. Assert for testing.
>>> 2261:   assert(is_valid_method(o), "should be valid jmethodid");
>> 
>> nit typo: s/jmethodid/jmethodID/
>
> I think you need a comment for L2262 to explain why you return NULL
> when the class loader is no longer alive. I think it's because it's racy
> if the class loader is no longer alive to return the jmethodID.
> 
> However, if that is racy, then does that mean that the above new assert()
> is also racy?

The assert isn't racy because there needs to be a safepoint in between changing the color of the oop pointers, so if there's a Method there, the class loader liveness won't change state in between.  The assert checks for the unexpected case where it's corrupted.

-------------

PR: https://git.openjdk.java.net/jdk/pull/4643


More information about the hotspot-dev mailing list