RFR: 8236272: Improve fidelity between contents of default CDS archive and classes loaded at runtime

Ioi Lam ioi.lam at oracle.com
Tue Jan 28 01:09:39 UTC 2020


Hi Claes,

This looks OK to me. One thing I noticed is when running 
-XX:DumpLoadedClassList from the "real" JDK image, with CDS enabled, I 
get more classes such as these:

 > java/lang/invoke/BoundMethodHandle$Species_LJ
 > java/lang/invoke/BoundMethodHandle$Species_LL
 > java/lang/invoke/BoundMethodHandle$Species_LLL
 > java/lang/invoke/BoundMethodHandle$Species_LLLL
 > java/lang/invoke/BoundMethodHandle$Species_LLLLL
 > java/lang/invoke/BoundMethodHandle$Species_LLLLLL
 > java/lang/invoke/BoundMethodHandle$Species_LLLLLLL
 > java/lang/invoke/BoundMethodHandle$Species_LLLLLLLL
 > java/lang/invoke/BoundMethodHandle$Species_LLLLLLLLL

I think these are generated later in the build process. Should we try to 
get these into the CDS archive as well? My unscientific measurement 
shows about 500K fewer instructions and up to half a percent elapsed 
time improvement (vs jdk/jdk, without your patch).

Also, these classes are not longer in the classlist, because they are 
used only when building the archived heap objects.

< java/lang/invoke/ClassSpecializer$Factory$1Var
< java/lang/module/ModuleDescriptor$Modifier
 > java/lang/Module$ReflectionData
< java/lang/NoSuchMethodError
< sun/nio/cs/StandardCharsets$Aliases
< sun/nio/cs/StandardCharsets$Cache
< sun/nio/cs/Surrogate
< sun/nio/cs/Surrogate$Parser
< sun/nio/cs/US_ASCII$Encoder
< sun/nio/cs/UTF_16
< sun/nio/cs/UTF_16BE
< sun/nio/cs/UTF_16LE
< ... more ...

That might cause a slight degradation when running without archived 
objects (such as -XX:+UseSerialGC) where these classes will be loaded. 
Have you measured the differences?

Thanks
- Ioi

On 1/27/20 9:13 AM, Claes Redestad wrote:
> Hi,
>
> when generating the default classlist, doing an extra pass with a
> -Xshare:dump between means the final classlist will be more in line
> with what will be used at runtime.
>
> Webrev: http://cr.openjdk.java.net/~redestad/8236272/open.00/
> Bug:    https://bugs.openjdk.java.net/browse/JDK-8236272
>
> This removes a number of classes from being dumped into the default
> archive, effectively reducing size by ~170Kb (~1.5%).
>
> The size reduction might be improved upon further in the future by
> making sure that -Xshare:dump can be limited to not dump classes not
> listed in the generated classlist, but this requires changes to the
> runtime and needs to be thoroughly examined.
>
> Such potential improvements will probably need this build-time fix to be
> effective. In the mean-time, this patch provides a small but clear gain.
>
> Thanks!
>
> /Claes




More information about the build-dev mailing list