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
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
- causes
-
JDK-8350666 cmp-baseline builds fail after JDK-8280682
-
- Resolved
-
-
JDK-8350619 [premain] Reimplement -XX:CacheOnlyClassesIn after JDK-8280682
-
- Open
-
- links to
-
Commit(master) openjdk/jdk/ddb25691
-
Review(master) openjdk/jdk/23476