RFR(M) 8192921 Improve CDS support for custom loaders
Ioi Lam
ioi.lam at oracle.com
Sat Dec 22 05:16:43 UTC 2018
http://cr.openjdk.java.net/~iklam/jdk13/8192921-cds-cust-loader-improve.v01/
https://bugs.openjdk.java.net/browse/JDK-8192921
ISSUE:
In JDK 12, there's experimental support for custom loader in CDS.
However, there are limitations:
1. if two or more custom loaders want to load a class named "A", only
one of those loaders can actually succeed in loading an archived
class.
2. the classlist needs to be hand-crafted (or by a script that parses
the output of -Xlog:class+load=debug).
FIX:
1. Now you can archive multiple classes of the same name. At run
time, we select an archived class that
(a) matches the fingerprint of the class file, and
(b) matches the class hierarchy of the current loader.
(b) is the tricky part. See
SystemDictionaryShared::has_same_hierarchy_for_unregistered_class
For a test case, see DuplicatedClassesTest.java
2. -XX:DumpLoadedClassList now automatically includes classes loaded
by custom loaders. The generated class list includes all the
necessary attributes for custom loader support, such as "super:",
"source:" and "interface:".
I have tested with Eclipse IDE, which loads most of its classes with
custom loaders. I am planning to add more test cases.
Thanks
- Ioi
More information about the hotspot-runtime-dev
mailing list