JDK-8345635 : JVMCI compiler should not be disabled by java -Xshare:dump
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 24
  • Priority: P3
  • Status: Closed
  • Resolution: Won't Fix
  • Submitted: 2024-12-06
  • Updated: 2025-06-11
  • Resolved: 2025-06-11
Related Reports
Relates :  
Sub Tasks
JDK-8346159 :  
Description
[Bad] the CDS archive cannot use full module graph with -XX:+UseJVMCICompiler 

$ java -XX:+UnlockExperimentalVMOptions -XX:+UseJVMCICompiler -Xshare:dump
Java HotSpot(TM) 64-Bit Server VM warning: JVMCI Compiler disabled due to -Xint.
$ java -XX:+UnlockExperimentalVMOptions -XX:+UseJVMCICompiler -Xlog:cds --version | grep full.module
[0.013s][info][cds] full module graph: enabled
[0.013s][info][cds] full module graph: disabled
[0.013s][info][cds] full module graph: disabled
[0.017s][info][cds] full module graph: disabled
[0.017s][info][cds] full module graph: disabled
[0.017s][info][cds] full module graph: disabled
[0.017s][info][cds] initial full module graph: disabled

[Good] You can work around this problem with adding -Xmixed

$ java -Xmixed -XX:+UnlockExperimentalVMOptions -XX:+UseJVMCICompiler -Xshare:dump
$ java -XX:+UnlockExperimentalVMOptions -XX:+UseJVMCICompiler -Xlog:cds --version | grep full.module
[0.013s][info][cds] full module graph: enabled
[0.013s][info][cds] full module graph: enabled
[0.013s][info][cds] full module graph: enabled
[0.017s][info][cds] full module graph: enabled
[0.017s][info][cds] full module graph: enabled
[0.017s][info][cds] full module graph: enabled
[0.017s][info][cds] initial full module graph: enabled
[0.017s][info][cds] use_full_module_graph = true; java.base = 0x00007246a6554908

========== Proposed fix
$ git diff
diff --git a/src/hotspot/share/cds/cdsConfig.cpp b/src/hotspot/share/cds/cdsConfig.cpp
index 6ab77bf0007..4f08a667e00 100644
--- a/src/hotspot/share/cds/cdsConfig.cpp
+++ b/src/hotspot/share/cds/cdsConfig.cpp
@@ -429,7 +429,7 @@ bool CDSConfig::check_vm_args_consistency(bool patch_mod_javabase, bool mode_fla
   }
 
   if (is_dumping_static_archive()) {
-    if (!mode_flag_cmd_line) {
+    if (!mode_flag_cmd_line JVMCI_ONLY(&& !EnableJVMCI)) {
       // By default, -Xshare:dump runs in interpreter-only mode, which is required for deterministic archive.
       //
       // If your classlist is large and you don't care about deterministic dumping, you can use



Comments
The proposed change is no longer necessary after JDK-8345826. Closing as WNF.
11-06-2025

Update: this bug is no longer applicable after JDK-8345826 (Do not automatically resolve jdk.internal.vm.ci when libgraal is used). We still have some jtreg settings that exclude certain test cases for libgraal testing. E.g., https://github.com/openjdk/jdk/blob/9ca1004e76a614328cd2eb7546143839c4d2f810/test/hotspot/jtreg/runtime/cds/appcds/aotClassLinking/BulkLoaderTest.java#L32-L33 * @comment work around JDK-8345635 * @requires !vm.jvmci.enabled We should remove such exclusions (see JDK-8357591) and then close this bug as will-not-fix.
22-05-2025

The current plan is to wait for https://github.com/openjdk/jdk/pull/23408 from the graal team. After that, it should be OK to disable the JIT compiler during -Xshare:dump, whether JVMCI compiler is used or not. See proposal "B": https://github.com/openjdk/jdk/pull/23408#issuecomment-2852397658 https://github.com/openjdk/jdk/pull/23408#issuecomment-2854105345
13-05-2025

The failure is coming from the attempt to create a CDS shared archive here: https://github.com/oracle/graal/blob/f9078d79d5be520c4f6ab9d7e74268418d3922eb/sdk/mx.sdk/mx_sdk_vm.py#L1162 Adding `-Xint` to the java command line makes it work although I'm not that's the right fix.
13-12-2024

The PR https://git.openjdk.org/jdk/pull/22687 causes errors in tier1-check-libgraal-present. This needs to be investigated before we can proceed with the fix. Building Java module org.graalvm.truffle (truffle-api.jar) from TRUFFLE_API Note: /System/Volumes/Data/mesos/work_dir/slaves/0679609c-41bc-42ab-b38d-2055d8be2197-S1475/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/03d7b78b-43cd-4df4-ad16-c0e7d3297287/runs/02a791b5-1ae3-43d0-8875-0210ec925720/workspace/build/macosx-aarch64-debug/support/mxbuild/truffle/dists/jdk21/truffle-api.jar.files/module-info.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: /System/Volumes/Data/mesos/work_dir/slaves/0679609c-41bc-42ab-b38d-2055d8be2197-S1475/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/03d7b78b-43cd-4df4-ad16-c0e7d3297287/runs/02a791b5-1ae3-43d0-8875-0210ec925720/workspace/build/macosx-aarch64-debug/support/mxbuild/truffle/dists/jdk21/truffle-api.jar.files/module-info.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. [1.005s][warning][jit,compilation] JVMCI compiler disabled after 11 of 11 upcalls had errors (Last error: "uncaught exception in get_HotSpotJVMCIRuntime [java.util.ServiceConfigurationError: jdk.vm.ci.services.JVMCIServiceLocator: Provider jdk.graal.compiler.hotspot.HotSpotGraalJVMCIServiceLocator could not be instantiated]"). Use -Xlog:jit+compilation for more detail. [1.711s][warning][cds,heap ] Archive heap points to a static field that may hold a different value at runtime: [1.711s][warning][cds,heap ] Field: java/lang/StackTraceElement$HashedModules::HASHED_MODULES [1.711s][warning][cds,heap ] Value: java.util.ImmutableCollections$SetN [1.711s][warning][cds,heap ] {0x00000007fef00cb8} - klass: 'java/util/ImmutableCollections$SetN' - flags: [1.711s][warning][cds,heap ] [1.711s][warning][cds,heap ] - ---- fields (total size 3 words): [1.711s][warning][cds,heap ] - final 'size' 'I' @12 0 (0x00000000) [1.711s][warning][cds,heap ] - final 'elements' '[Ljava/lang/Object;' @16 a 'java/lang/Object'[0] {0x00000007fef00cd0} (0xffde019a) [1.711s][warning][cds,heap ] --- trace begin --- [1.711s][warning][cds,heap ] [ 0] {0x00000007f806ea90} jdk.internal.module.ArchivedModuleGraph::finder (offset = 16) [1.711s][warning][cds,heap ] [ 1] {0x00000007f806eab8} jdk.internal.module.SystemModuleFinders$SystemModuleFinder::mrefs (offset = 12) [1.711s][warning][cds,heap ] [ 2] {0x00000007f806ead0} java.util.ImmutableCollections$SetN::elements (offset = 16) [1.711s][warning][cds,heap ] [ 3] {0x00000007f806eae8} [Ljava.lang.Object; @[0] [1.711s][warning][cds,heap ] [ 4] {0x00000007fef1a178} jdk.internal.module.ModuleReferenceImpl::descriptor (offset = 12) [1.711s][warning][cds,heap ] [ 5] {0x00000007fef1a1b0} java.lang.module.ModuleDescriptor::modifiers (offset = 32)::opens (offset = 44) [1.711s][warning][cds,heap ] [ 6] {0x00000007fef00cb8} java.util.ImmutableCollections$SetN [1.711s][warning][cds,heap ] --- trace end --- [1.711s][warning][cds,heap ] [1.711s][error ][cds,heap ] Scanned 34939 objects. Found 1 case(s) where an object points to a static field that may hold a different value at runtime. [1.711s][error ][cds ] An error has occurred while writing the shared archive file.
13-12-2024

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/22687 Date: 2024-12-11 19:04:49 +0000
11-12-2024

To work around this problem during jtreg testing with graal+AOTClassLinking, the following should be added to "make test": $ make test TEST_OPTS_VM_OPTIONS="--add-modules=jdk.internal.vm.ci ...."
06-12-2024