RFR: 8251261: CDS dumping should not clear states in live classes [v3]

Calvin Cheung ccheung at openjdk.java.net
Wed Sep 23 21:58:52 UTC 2020


On Wed, 23 Sep 2020 21:03:51 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.
>
> Ioi Lam has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes
> the unrelated changes brought in by the merge/rebase. The pull request contains five additional commits since the last
> revision:
>  - Merge branch 'master' into 8251261-cds-shouldnt-clear-states-of-live-classes
>  - Merge branch 'master' into 8251261-cds-shouldnt-clear-states-of-live-classes
>  - restore assert for shared class
>  - Merge branch 'master' into 8251261-cds-shouldnt-clear-states-of-live-classes
>  - 8251261: CDS dumping should not clear states in live classes

Marked as reviewed by ccheung (Reviewer).

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

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


More information about the hotspot-runtime-dev mailing list