git: openjdk/leyden: hermetic-java-runtime: 2 new changesets

duke duke at openjdk.org
Mon Nov 27 23:01:48 UTC 2023


Changeset: 47b3fbcc
Author:    Jiangli Zhou <jianglizhou at google.com>
Date:      2023-08-18 17:50:36 +0000
URL:       https://git.openjdk.org/leyden/commit/47b3fbcccc943a1a3e758776ff3cd356088972d4

JDK support for hermetic JAR packaged jimage (aka runtime image).

This handles the JDK runtime image that's packaged within the hermetic JAR at a specific file offset (page aligned). In hermetic JAR, the <JDK>/lib/'modules' data is packed within the JVM data section, which is between the ELF section and the JAR section in a deploy JAR. The start offset of the 'modules' data is page aligned. Special launcher argument that can be passed to the VM:

  -XX:UseHermeticJDK=<deploy_jar_path>,<jimage_start_offset>

The jimage start offset is used when opening/mapping and reading the jimage.

! src/hotspot/share/classfile/classLoader.cpp
! src/hotspot/share/runtime/arguments.cpp
! src/hotspot/share/runtime/arguments.hpp
! src/hotspot/share/runtime/globals.hpp
! src/hotspot/share/runtime/os.cpp
! src/hotspot/share/runtime/threads.cpp
! src/java.base/share/native/libjimage/imageFile.cpp
! src/java.base/share/native/libjimage/imageFile.hpp
! src/java.base/share/native/libjimage/jimage.cpp
! src/java.base/share/native/libjimage/jimage.hpp

Changeset: 7bc0ac53
Author:    Jiangli Zhou <jianglizhou at google.com>
Date:      2023-08-18 20:50:10 +0000
URL:       https://git.openjdk.org/leyden/commit/7bc0ac530f3ac0e7008a5285c4e47f007eec9ed5

Map hermetic packaged modules using the modules size correctly.

With the hermetic Java support, we embed the JDK 'modules' image in the hermetic JAR at page aligned offset. The offset is recorded in the deploy JAR manifest 'JDK-Lib-Modules-Offset' attribute. At runtime, the recorded offset information is used by the VM to mmap the modules image.

Also, record the 'modules' file size in deploy JAR manifest 'JDK-Lib-Modules-Size' attribute. The VM option, -XX:UseHermeticJDK is extended to include the image size:

  -XX:UseHermeticJDK:<executable_image_file_path>,<jdk_runtime_image_start_offset>,<jimage_size>

At runtime, modules size from the manifest attribute may be retrieved and passed to the VM via -XX:UseHermeticJDK option. Both the hermetic 'modules' image offset and size are used when mmap'ing the 'modules' data.

! src/hotspot/share/classfile/classLoader.cpp
! src/hotspot/share/runtime/arguments.cpp
! src/hotspot/share/runtime/arguments.hpp
! src/java.base/share/native/libjimage/imageFile.cpp
! src/java.base/share/native/libjimage/imageFile.hpp
! src/java.base/share/native/libjimage/jimage.cpp
! src/java.base/share/native/libjimage/jimage.hpp



More information about the leyden-dev mailing list