RFR: 8314846: Do not store Klass::_secondary_super_cache in CDS archive

Ioi Lam iklam at openjdk.org
Thu Apr 18 22:23:04 UTC 2024


This bug was found during Leyden development.

CDS's `ArchiveBuilder` expects the class metadata to stop mutating while we're inside the CDS dumping safepoint. However, `Klass::_secondary_super_cache` can be updated as a side effect of `Klass::is_subtype_of()`.

Currently, we don't call `Klass::is_subtype_of()`inside the CDS safepoint. However, it's likely that future optimizations will make such calls (as being done in the Leyden prototype). When that happens, the CDS dump will fail with a hard-to-debug failure (some class is found inside `_secondary_super_cache` that `ArchiveBuilder` doesn't know about.

There's no benefit in storing `Klass::_secondary_super_cache` in the CDS archive. So the safest thing to do is to stop scanning it during CDS dumping, and clear it to `nullptr` when the `Klass` is stored in the CDS archive.

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

Commit messages:
 - 8314846: Do not store Klass::_secondary_super_cache in CDS archive

Changes: https://git.openjdk.org/jdk/pull/18848/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=18848&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8314846
  Stats: 6 lines in 1 file changed: 5 ins; 1 del; 0 mod
  Patch: https://git.openjdk.org/jdk/pull/18848.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/18848/head:pull/18848

PR: https://git.openjdk.org/jdk/pull/18848


More information about the hotspot-dev mailing list