RFR: 8268364: jmethod clearing should be done during unloading
Coleen Phillimore
coleenp at openjdk.java.net
Wed Jun 30 22:56:13 UTC 2021
This patch moves the jmethod clearing to ClassLoaderData::unload() but also adds a check to Method::checked_resolved_jmethod_id() to handle the case where ZGC may be unloading a class but not have gotten to ClassLoaderData::unload() yet. JVMTI will read a NULL method for checked_resolved_jmethod_id() in this case, and not get a Method that will shortly, or has already been reclaimed in the Metaspace destructor.
Since I was there, I also added Method::is_valid_method() check to checked_resolve_jmethod_id. I don't think it's expensive anymore but it could be added under DEBUG. Either way method->method_holder()->is_loader_alive() will crash if !is_valid_method so we should leave it. As I wrote in the related issues, the bogus Method may have been because of a previous set of bugs with post_compiled_method_load events.
Tested with tiers 1-6 on linux-x64-debug and 1-3 on windows-x64-debug.
Also ran vmTestbase/nsk/{jdi,jvmti} tests with VM_OPTIONS=-XX:+UseZGC -XX:ZCollectionInterval=0.01 -XX:ZFragmen
tationLimit=0
-------------
Commit messages:
- Make is_valid_method() an assert.
- 8213466: Method::checked_resolve_jmethod_id() could do better checks
- 8268364: jmethod clearing should be done during unloading
Changes: https://git.openjdk.java.net/jdk/pull/4643/files
Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=4643&range=00
Issue: https://bugs.openjdk.java.net/browse/JDK-8268364
Stats: 33 lines in 2 files changed: 17 ins; 13 del; 3 mod
Patch: https://git.openjdk.java.net/jdk/pull/4643.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/4643/head:pull/4643
PR: https://git.openjdk.java.net/jdk/pull/4643
More information about the hotspot-dev
mailing list