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

Refactor AOT code source validation checks

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 25
    • 19
    • hotspot
    • b12

      The CDS classpath validation checking code has evolved over time and become difficult to maintain:

      E.g. https://github.com/openjdk/jdk/blob/c1d322fff42720146dfb3846bd7d8514b1bdf383/src/hotspot/share/cds/filemap.cpp#L812-L877

      [1] CDS needs to remember where a class was loaded from during dump time (i.e., the "code source"
          of a class. This information is stored in two places (ClassPathEntry and SharedClassPathEntry).
          Also, ClassPathEntry was originally designed for loading classes from the boot loader. It's
          better to remove the CDS-related code from this class.

      [2] The discovery of the CDS "code sources" are mingled in classLoader.cpp, which was designed
          to support only the boot classloader. But CDS adds extra code in classLoader.cpp for supporting
          the app class loaders, too. We should move the CDS code to its own module.

      [3] SharedClassPathEntry are modified (and restored) when dumping the dynamic archive. We should
          get rid of such modifications to make the code more reliable.

      [4] The code for validating the boot/app/module paths have duplications and should be refactored.

      Proposal:

      - Add new classes AOTCodeSource and AOTCodeSourceConfig for managing the code sources for CDS
       (i.e., where classes were loaded from during dump time).

      - Add uniform iterators for the boot/app/module paths. See CodeSourceStream in aotCodeSource.cpp

      - Clean up the code for Longest Common Prefix (LCP)

      - Clean up the handling of non-existent classpath entries

      Prototype: https://github.com/iklam/jdk/tree/refactor-classpath-table

            ccheung Calvin Cheung
            iklam Ioi Lam
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: