When --add-exports is specified with "java -XX:AOTMode=create", AOTClassLinking is disabled:
=================================
$ java -cp HelloWorld.jar -XX:AOTMode=record \
-XX:AOTConfiguration=hw.aotconfig HelloWorld
Hello World
AOTConfiguration recorded: hw.aotconfig
$ java -Xlog:cds -XX:+AOTClassLinking --add-exports java.base/jdk.internal.misc=ALL-UNNAMED \
-cp HelloWorld.jar -XX:AOTMode=create -XX:AOTCache=hw.aot \
-XX:AOTConfiguration=hw.aotconfig
[...]
[0.000s][info][cds] optimized module handling: disabled due to incompatible property: jdk.module.addexports=java.base/jdk.internal.misc=ALL-UNNAMED
[...]
[0.456s][info][cds] Number of classes 1043
[0.456s][info][cds] instance classes = 891, aot-linked = 0, inited = 0
=================================
Proposal:
We should support --add-exports for AOT cache, and allow the AOT cache to be used as long as the exact same set of options --add-exports are used during assembly phase and production run.
=================================
$ java -cp HelloWorld.jar -XX:AOTMode=record \
-XX:AOTConfiguration=hw.aotconfig HelloWorld
Hello World
AOTConfiguration recorded: hw.aotconfig
$ java -Xlog:cds -XX:+AOTClassLinking --add-exports java.base/jdk.internal.misc=ALL-UNNAMED \
-cp HelloWorld.jar -XX:AOTMode=create -XX:AOTCache=hw.aot \
-XX:AOTConfiguration=hw.aotconfig
[...]
[0.000s][info][cds] optimized module handling: disabled due to incompatible property: jdk.module.addexports=java.base/jdk.internal.misc=ALL-UNNAMED
[...]
[0.456s][info][cds] Number of classes 1043
[0.456s][info][cds] instance classes = 891, aot-linked = 0, inited = 0
=================================
Proposal:
We should support --add-exports for AOT cache, and allow the AOT cache to be used as long as the exact same set of options --add-exports are used during assembly phase and production run.
- relates to
-
JDK-8352003 -XX:+AOTClassLinking is not compatible with --add-opens
-
- Open
-
- links to
-
Review(pr/24122) openjdk/jdk/24124