Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8245597

Avoid using ClassLoaderDataGraph::loaded_classes_do during -Xshare:dump

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Duplicate
    • Icon: P4 P4
    • tbd
    • 15
    • hotspot

      During -Xshare:dump, we run the following code to find all classes to be archived:

      http://hg.openjdk.java.net/jdk/jdk/file/0348e9be94d1/src/hotspot/share/memory/metaspaceShared.cpp#l1582

        CollectClassesClosure collect_classes;
        ClassLoaderDataGraph::loaded_classes_do(&collect_classes);

      However, CDS already maintains DumpTimeSharedClassTable that contains all possible classes that can be archived, and most of the CDS code iterates over this table (e.g., when writing the shared dictionaries). There's a potential risk that the ClassLoaderDataGraph may get out of sync DumpTimeSharedClassTable (unlikely but who knows), so it's better for all CDS code to exclusively use DumpTimeSharedClassTable.

      NB., the above is only for -Xshare:dump (aka static dumping). We don't call ClassLoaderDataGraph::loaded_classes_do during -XX:ArchiveClassesAtExit (aka dynamic dumping).

            Unassigned Unassigned
            iklam Ioi Lam
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: