An exploration of the evolution possibility of Jmod format: Fallback Jmod
Glavo
zjx001202 at gmail.com
Mon Feb 21 12:35:14 UTC 2022
I talked about Jmod on the Jigsaw mailing list the other day [1]: The
current distribution method of Jmod files has caused a lot of redundant
information in the JDK,
which makes the size of the JDK unnecessarily enlarged, which brings
unnecessary troubles to CI, containers, and virtual machines.
At the same time, the lack of a separately distributed Jmod file also
brings more trouble to the use of Jlink.
During this time, I spent two nights implementing a prototype. I used it
based on SapMachine JDK, it works without breaking any JDK functionality
(in theory), and it worked to my satisfaction:
It reduces the size of `sapmachine-jdk-17.0.2.tar.gz` from 184MB to 115MB,
and the decompressed size is reduced from 316MB to 242M.
The reason for getting such a size reduction is that we reduced the Jmod
file from 77MB to 2.4MB.
It greatly reduces the size of the Jmod file by reusing the files that
already exist in the JDK while ensuring that the files are not lossless.
By calculating and recording the file hash value, it will not cause the
content of Jmod to be irreversibly modified due to file differences caused
by Jlink plugins.
All files that may not be recovered, such as files with conflicting
contents in the runtime image and Jmod, and configuration files, etc., are
kept in Jmod to ensure that the reduction process is really lossless.
At the same time, I also implemented a Jlink plugin, which can be used by
Jlink transparently without pre-recovery.
I put this prototype on GitHub, I hope it will be an exploration of the
future of OpenJDK.
And I hope that similar feature will hopefully be integrated into the JDK
at some point in the future,
rely on this to reduce the size of the JDK distribution.
I want to get your opinions, thank you so much.
Here is its GitHub repository:
https://github.com/Glavo/fallback-jmod/
(I sent this email to the Jigsaw mailing list a few days ago but no
response, so I am sending it here. Please let me know if this is not the
right place.)
[1]:
https://mail.openjdk.java.net/pipermail/jigsaw-dev/2022-February/014780.html
More information about the jdk-dev
mailing list