Skip to content

Commit 40f2aae

Browse files
committed
[GR-61608] Add Graal compiler modules to Graal image VM options
PullRequest: graal/20044
2 parents 3978176 + bd311db commit 40f2aae

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

sdk/mx.sdk/mx_sdk_vm.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -841,11 +841,19 @@ def _get_image_vm_options(jdk, use_upgrade_module_path, modules, synthetic_modul
841841
if 'jdk.graal.compiler' in non_synthetic_modules and mx_sdk_vm_impl._get_libgraal_component() is None:
842842
# If libgraal is absent, jargraal is used by default.
843843
# Use of jargraal requires exporting jdk.internal.misc to
844-
# Graal as it uses jdk.internal.misc.Unsafe.
844+
# Graal as it uses jdk.internal.misc.Unsafe. To avoid warnings
845+
# about unknown modules (e.g. in `-Xint` mode), the export target
846+
# modules must be explicitly added to the root set with `--add-modules`.
845847
if 'com.oracle.graal.graal_enterprise' in non_synthetic_modules:
846-
vm_options.extend(['--add-exports=java.base/jdk.internal.misc=jdk.graal.compiler,com.oracle.graal.graal_enterprise'])
848+
vm_options.extend([
849+
'--add-modules=jdk.graal.compiler,com.oracle.graal.graal_enterprise',
850+
'--add-exports=java.base/jdk.internal.misc=jdk.graal.compiler,com.oracle.graal.graal_enterprise'
851+
])
847852
else:
848-
vm_options.extend(['--add-exports=java.base/jdk.internal.misc=jdk.graal.compiler'])
853+
vm_options.extend([
854+
'--add-modules=jdk.graal.compiler',
855+
'--add-exports=java.base/jdk.internal.misc=jdk.graal.compiler'
856+
])
849857
else:
850858
# Don't default to using JVMCI as JIT unless Graal is being updated in the image.
851859
# This avoids unexpected issues with using the out-of-date Graal compiler in

0 commit comments

Comments
 (0)