If a Lambda Proxy class has been stored in the CDS static archive, we still generate it again for the dynamic archive. This wastes space in the dynamic archive.
==========
$ java -Xshare:off -XX:DumpLoadedClassList=javac.classlist com.sun.tools.javac.Main HelloWorld.java
$ grep @lambda-proxy javac.classlist | wc -l
169
$ java -Xshare:dump -XX:SharedClassListFile=javac.classlist -XX:SharedArchiveFile=javac-static.jsa -Xlog:cds=debug
[...]
[1.702s][info ][cds] Number of classes 2512
[1.702s][info ][cds] instance classes = 2402
[1.702s][info ][cds] boot = 1199
[1.702s][info ][cds] app = 1133
[1.702s][info ][cds] platform = 70
[1.702s][info ][cds] unregistered = 0
[1.702s][info ][cds] (hidden) = 172 << lambda proxy classes
[1.702s][info ][cds] (unlinked) = 0
[1.702s][info ][cds] obj array classes = 101
[1.702s][info ][cds] type array classes = 9
[1.702s][info ][cds] symbols = 57098
$ java -XX:SharedArchiveFile=javac-static.jsa -XX:ArchiveClassesAtExit=javac-dynamic.jsa -Xlog:cds=debug com.sun.tools.javac.Main HelloWorld.java
[...]
[0.967s][info ][cds] Number of classes 172
[0.967s][info ][cds] instance classes = 172
[0.967s][info ][cds] boot = 42
[0.967s][info ][cds] app = 130
[0.967s][info ][cds] platform = 0
[0.967s][info ][cds] unregistered = 0
[0.967s][info ][cds] (hidden) = 168 << same lambda proxy classes are generated again
[0.967s][info ][cds] (unlinked) = 0
[0.967s][info ][cds] obj array classes = 0
[0.967s][info ][cds] type array classes = 0
[0.967s][info ][cds] symbols = 168
==========
$ java -Xshare:off -XX:DumpLoadedClassList=javac.classlist com.sun.tools.javac.Main HelloWorld.java
$ grep @lambda-proxy javac.classlist | wc -l
169
$ java -Xshare:dump -XX:SharedClassListFile=javac.classlist -XX:SharedArchiveFile=javac-static.jsa -Xlog:cds=debug
[...]
[1.702s][info ][cds] Number of classes 2512
[1.702s][info ][cds] instance classes = 2402
[1.702s][info ][cds] boot = 1199
[1.702s][info ][cds] app = 1133
[1.702s][info ][cds] platform = 70
[1.702s][info ][cds] unregistered = 0
[1.702s][info ][cds] (hidden) = 172 << lambda proxy classes
[1.702s][info ][cds] (unlinked) = 0
[1.702s][info ][cds] obj array classes = 101
[1.702s][info ][cds] type array classes = 9
[1.702s][info ][cds] symbols = 57098
$ java -XX:SharedArchiveFile=javac-static.jsa -XX:ArchiveClassesAtExit=javac-dynamic.jsa -Xlog:cds=debug com.sun.tools.javac.Main HelloWorld.java
[...]
[0.967s][info ][cds] Number of classes 172
[0.967s][info ][cds] instance classes = 172
[0.967s][info ][cds] boot = 42
[0.967s][info ][cds] app = 130
[0.967s][info ][cds] platform = 0
[0.967s][info ][cds] unregistered = 0
[0.967s][info ][cds] (hidden) = 168 << same lambda proxy classes are generated again
[0.967s][info ][cds] (unlinked) = 0
[0.967s][info ][cds] obj array classes = 0
[0.967s][info ][cds] type array classes = 0
[0.967s][info ][cds] symbols = 168
- relates to
-
JDK-8316440 LambdasInTwoArchives.java failed to find WhiteBox.class
- Resolved