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

Claes Redestad claes.redestad at oracle.com
Tue Jan 28 09:59:09 UTC 2020


Hi Ioi,

On 2020-01-28 02:09, Ioi Lam wrote:
> 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).

right, these classes are generated by jlink, so they're not seen by the
invocation of HelloClasslist that generates the final classlist
(line 75 in GenerateLinkOpt). To get them into the classlist, we could
do another pass of creating an interim image, dump CDS again, generate a
new classlist - or we could add logic somewhere to append to the
classlist using the information we log to $JLI_TRACE_FILE.

Before we do that, I have a related RFE I'd like to deal with to clean
up what JLI classes jlink generates by default, since it's rather
outdated: https://bugs.openjdk.java.net/browse/JDK-8230301

> 
> 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?

On my setup it adds 1-2M instructions to -XX:+UseSerialGC, but I think
rather than keeping these in the default archive we should fix
https://bugs.openjdk.java.net/browse/JDK-8234679 to get Serial and
other GCs see (most of) the benefits of heap archiving.

Thanks!

/Claes



More information about the build-dev mailing list