Skip to content

[JDK-8345826] Replace +EnableJVMCI with --add-modules=jdk.internal.vm.ci. #11212

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ci/common.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ local common_json = import "../common.json";
[name]: jdk_base + common_json.jdks[name] + { jdk_version:: 21 }
for name in ["oraclejdk21"] + variants("labsjdk-ce-21") + variants("labsjdk-ee-21")
} + {
'oraclejdk23': jdk_base + common_json.jdks["oraclejdk23"] + { jdk_version:: 23 },
'oraclejdk24': jdk_base + common_json.jdks["oraclejdk24"] + { jdk_version:: 24 },
} + {
[name]: jdk_base + common_json.jdks[name] + { jdk_version:: parse_labsjdk_version(self), jdk_name:: "jdk-latest"}
for name in ["oraclejdk-latest"] + variants("labsjdk-ce-latest") + variants("labsjdk-ee-latest")
Expand Down
6 changes: 3 additions & 3 deletions common.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@
"labsjdk-ee-21-llvm": {"name": "labsjdk", "version": "ee-21.0.2+13-jvmci-23.1-b33-sulong", "platformspecific": true },
"graalvm-ee-21": {"name": "graalvm-java21", "version": "23.1.6", "platformspecific": true },

"oraclejdk23": {"name": "jpg-jdk", "version": "23", "build_id": "jdk-23+37", "platformspecific": true, "extrabundles": ["static-libs"]},
"oraclejdk24": {"name": "jpg-jdk", "version": "24", "build_id": "jdk-24.0.1+9", "platformspecific": true, "extrabundles": ["static-libs"]},

"oraclejdk-latest": {"name": "jpg-jdk", "version": "25", "build_id": "jdk-25+22", "platformspecific": true, "extrabundles": ["static-libs"]},
"labsjdk-ce-latest": {"name": "labsjdk", "version": "ce-25+22-jvmci-b01", "platformspecific": true },
"labsjdk-ce-latest": {"name": "jpg-jdk", "version": "25", "build_id": "2025-05-17-2228274.doug.simon.open", "platformspecific": true, "extrabundles": ["static-libs"]},
"labsjdk-ce-latestDebug": {"name": "labsjdk", "version": "ce-25+22-jvmci-b01-debug", "platformspecific": true },
"labsjdk-ce-latest-llvm": {"name": "labsjdk", "version": "ce-25+22-jvmci-b01-sulong", "platformspecific": true },
"labsjdk-ee-latest": {"name": "labsjdk", "version": "ee-25+22-jvmci-b01", "platformspecific": true },
"labsjdk-ee-latest": {"name": "jpg-jdk", "version": "25", "build_id": "2025-05-17-2228274.doug.simon.open", "platformspecific": true, "extrabundles": ["static-libs"]},
"labsjdk-ee-latestDebug": {"name": "labsjdk", "version": "ee-25+22-jvmci-b01-debug", "platformspecific": true },
"labsjdk-ee-latest-llvm": {"name": "labsjdk", "version": "ee-25+22-jvmci-b01-sulong", "platformspecific": true }
},
Expand Down
17 changes: 9 additions & 8 deletions docs/reference-manual/embedding/embed-languages.md
Original file line number Diff line number Diff line change
Expand Up @@ -411,19 +411,20 @@ Polyglot Truffle runtimes can be used on several host virtual machines with vary
Runtime optimization of guest application code is crucial for the efficient execution of embedded guest applications.
This table shows the level of optimizations the Java runtimes currently provide:

| Java Runtime | Runtime Optimization Level |
|-----------------------------------------------|---------------------------------------------------|
| Oracle GraalVM | Optimized with additional compiler passes |
| GraalVM Community Edition | Optimized |
| Oracle JDK | Optimized if enabled via experimental VM option |
| OpenJDK | Optimized if enabled via experimental VM option |
| JDK without JVMCI capability | No runtime optimizations (interpreter-only) |
| Java Runtime | Runtime Optimization Level |
|-----------------------------------------------|-----------------------------------------------------|
| Oracle GraalVM | Best (includes additional compiler optimizations) |
| GraalVM Community Edition | Optimized |
| Oracle JDK | Optimized via VM option |
| OpenJDK | Optimized via VM option and `--upgrade-module-path` |
| JDK without JVMCI capability | No runtime optimizations (interpreter-only) |

### Explanations

* **Optimized:** Executed guest application code can be compiled and executed as highly efficient machine code at run time.
* **Optimized with additional compiler passes:** Oracle GraalVM implements additional optimizations performed during runtime compilation. For example, it uses a more advanced inlining heuristic. This typically leads to better runtime performance and memory consumption.
* **Optimized if enabled via experimental VM option:** Optimization is not enabled by default and must be enabled using `-XX:+EnableJVMCI` virtual machine option. In addition, to support compilation, the Graal compiler must be downloaded as a JAR file and put on the `--upgrade-module-path`. In this mode, the compiler runs as a Java application and may negatively affect the execution performance of the host application.
* **Optimized via VM option:** Optimization is enabled by specifying `-XX:+EnableJVMCI` to the `java` launcher.
* **Optimized via VM option and `--upgrade-module-path`:** Optimization is enabled by specifying `-XX:+EnableJVMCI` to the `java` launcher. Additionally, the Graal compiler must be downloaded as a JAR file and specified to the `java` launcher with `--upgrade-module-path`. In this mode, the compiler runs as a Java application and may negatively affect the execution performance of the host application.
* **No runtime optimizations:** With no runtime optimizations or if JVMCI is not enabled, the guest application code is executed in interpreter-only mode.
* **JVMCI:** Refers to the [Java-Level JVM Compiler Interface](https://openjdk.org/jeps/243) supported by most Java runtimes.

Expand Down
15 changes: 11 additions & 4 deletions sdk/mx.sdk/mx_sdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,16 @@ def jlink_new_jdk(jdk, dst_jdk_dir, module_dists, ignore_dists,
default_to_jvmci=default_to_jvmci)

class GraalVMJDKConfig(mx.JDKConfig):

# Oracle JDK includes the libjvmci compiler, allowing it to function as GraalVM.
# However, the Graal compiler is disabled by default and must be explicitly
# enabled using the -XX:+UseGraalJIT option.
libgraal_additional_vm_args = [
'-XX:+UnlockExperimentalVMOptions',
'-XX:+EnableJVMCI',
'-XX:+UseGraalJIT',
'-XX:-UnlockExperimentalVMOptions'
]
"""
A JDKConfig that configures the built GraalVM as a JDK config.
"""
Expand All @@ -270,11 +280,8 @@ def __init__(self):
graalvm_home = default_jdk.home
additional_vm_args = []
elif GraalVMJDKConfig.is_libgraal_jdk(default_jdk.home):
# Oracle JDK includes the libjvmci compiler, allowing it to function as GraalVM.
# However, the Graal compiler is disabled by default and must be explicitly enabled using the -XX:+UseJVMCICompiler option.
graalvm_home = default_jdk.home
# GR-58388: Switch '-XX:+UseJVMCINativeLibrary' to '-XX:+UseGraalJIT'
additional_vm_args = ['-XX:+UnlockExperimentalVMOptions', '-XX:+EnableJVMCI', '-XX:+UseJVMCINativeLibrary', '-XX:-UnlockExperimentalVMOptions']
additional_vm_args = GraalVMJDKConfig.libgraal_additional_vm_args
else:
graalvm_home = mx_sdk_vm.graalvm_home(fatalIfMissing=True)
additional_vm_args = []
Expand Down
Loading
Loading