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

Ioi Lam iklam at openjdk.java.net
Wed Sep 23 21:03:51 UTC 2020


> 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

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

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/227/files
  - new: https://git.openjdk.java.net/jdk/pull/227/files/03f74855..a6029d97

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=227&range=02
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=227&range=01-02

  Stats: 4627 lines in 219 files changed: 1969 ins; 2132 del; 526 mod
  Patch: https://git.openjdk.java.net/jdk/pull/227.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/227/head:pull/227

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


More information about the hotspot-runtime-dev mailing list