RFR: 8251261: CDS dumping should not clear states in live classes
Yumin Qi
minqi at openjdk.java.net
Mon Sep 21 23:22:39 UTC 2020
On Thu, 17 Sep 2020 18:53:55 GMT, Ioi Lam <iklam at openjdk.org> wrote:
> We had an issue when CDS dumped a static archive (java -Xshare:dump), it would call `Klass::remove_unshareable_info()`
> too early. In one of the test failures, ZGC was still scanning the heap and stepped on a class whose mirror has been
> removed. The fix is to avoid modifying the states of the Java classes during -Xshare:dump. Instead, we call
> `Klass::remove_unshareable_info()` only on the **copy** of the classes which are written into the archive. It's safe to
> do so because these copies are visible only to the CDS dumping code. They aren't accessible by the GC or any other
> subsystems. It turns out that we were already doing this for the dynamic archive. So I just generalized the code in
> dynamicArchive.cpp and moved it to archiveBuilder.cpp. So this PR is one step forward for [JDK-8234693 Consolidate CDS
> static and dynamic archive dumping code](https://bugs.openjdk.java.net/browse/JDK-8234693). I also fixed another case
> where we modify the global VM state -- I removed `Universe::clear_basic_type_mirrors()`.
> ----
>
> We are still modifying some global VM states (such as SystemDictionary::_well_known_klasses). They seem harmless now,
> but we might have to do more fixes in the future.
Looks good to me.
-------------
Marked as reviewed by minqi (Reviewer).
PR: https://git.openjdk.java.net/jdk/pull/227
More information about the hotspot-runtime-dev
mailing list