JDK-8344556 : [Graal] compiler/intrinsics/bmi/* fail when AOTCache cannot be loaded
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 24
  • Priority: P5
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2024-11-19
  • Updated: 2025-06-19
  • Resolved: 2025-06-12
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 26
26 b02Fixed
Related Reports
Blocks :  
Relates :  
Relates :  
Description
The compiler/intrinsics/bmi/* tests produce an extra line of unexpected output when run with:
  -XX:AOTCache=./testoutput/test-support/jtreg_open_test_hotspot_jtreg_tier2_compiler/aot/jdk.aotcache  \
  -XX:+UnlockExperimentalVMOptions \
  -XX:+UseJVMCICompiler

[error][cds] CDS archive has aot-linked classes. It cannot be used when archived full module graph is not used.

Note that jdk.aotcache was generated with -XX:+AOTClassLinking but WITHOUT  -XX:+UseJVMCICompiler

This makes the test fail, which doesn't expect this extra output.

Only seen with Graal so far, but it's unclear why. Nor is it clear what these particular tests of arithmetic operations have to do with CDS. The somewhat similar issue https://bugs.openjdk.org/browse/JDK-8342438 was considered a test bug.
Comments
Changeset: 3b32f6a8 Branch: master Author: Ioi Lam <iklam@openjdk.org> Date: 2025-06-12 00:41:39 +0000 URL: https://git.openjdk.org/jdk/commit/3b32f6a8ec37338764d3e6713247ff96e49bf5b3
12-06-2025

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/25761 Date: 2025-06-11 18:28:35 +0000
11-06-2025

[~iklam] You need also remove these tests from Graal's problem list. In JDK-8358738 I added check for compiler type into archive header and check for Graal vs other JIT. hs-tier9-graal and hs-tier12-graal passed. hs-tier10-graal is still running.
11-06-2025

[~kvn] I'll add "-Xlog:aot*=off" in the fix for this bug. I'll let you decide what else to do (if anything) in JDK-8358738
11-06-2025

But by adding "-Xlog:aot*=off" in JDK-8358738 to these tests we will allow to run them regardless what happens with AOT cache. Do you want this change be done in this bug fix instead?
09-06-2025

This bug is not an duplicate of JDK-8358738: - JDK-8358738 happened due to AOT profile differences. - This bug happened due to module differences, which has been fixed in JDK-8345826.
09-06-2025

Is this duplicate of JDK-8358738 ?
09-06-2025

Need to check again after JDK-8345826 is integrated.
16-01-2025

After off-line discussion with [~dnsimon], it seems that we can avoid these testing problems altogether if we implement JDK-8345826. So before JDK-8345826 is fixed, we should exclude the failing tests from test tasks that enable both graal and -XX:+AOTClassLinking.
09-12-2024

After more thought, modifying task definitions can have other broad side-effects. In this case, adding --add-modules=jdk.internal.vm.ci forces the JVMCI module to be loaded unconditionally in all libgraal jobs. Since JDK-8298099, loading jdk.internal.vm.ci is not required for libgraal. As such, this may cause failures when tests are run on images that do not include jdk.internal.vm.ci.
09-12-2024

[~lmesnik] can probably help you make this change Ioi - he knows the graal task definitions best.
06-12-2024

The underlying problem is the jdk.internal.vm.ci module is enabled only when running with -Xmixed or -Xcomp, but disabled with -Xint. To fix this, we should always add --add-modules=jdk.internal.vm.ci to the VM options when running the compiler/intrinsics/bmi tests with graal + JTREG_AOT_JDK=true: [baseline] $ time make test \ JTREG_AOT_JDK=true \ TEST_OPTS_VM_OPTIONS="-XX:+AOTClassLinking" \ TEST=open/test/hotspot/jtreg/compiler/intrinsics/bmi/TestLzcntL.java ============================== Test summary ============================== TEST TOTAL PASS FAIL ERROR jtreg:open/test/hotspot/jtreg/compiler/intrinsics/bmi/TestLzcntL.java 1 1 0 0 ============================== TEST SUCCESS [bad] $ env JVMCI_VERSION_CHECK=ignore make test \ JTREG_AOT_JDK=true \ TEST_OPTS_VM_OPTIONS="-XX:+AOTClassLinking -XX:+UnlockExperimentalVMOptions -XX:+UseJVMCICompiler" \ JTREG_OPTIONS="-e:JVMCI_VERSION_CHECK=ignore" \ TEST=open/test/hotspot/jtreg/compiler/intrinsics/bmi/TestLzcntL.java ============================== Test summary ============================== TEST TOTAL PASS FAIL ERROR jtreg:open/test/hotspot/jtreg/compiler/intrinsics/bmi/TestLzcntL.java >> 1 0 1 0 << ============================== TEST FAILURE [ good] $ env JVMCI_VERSION_CHECK=ignore make test \ JTREG_AOT_JDK=true \ TEST_OPTS_VM_OPTIONS="--add-modules=jdk.internal.vm.ci -XX:+AOTClassLinking -XX:+UnlockExperimentalVMOptions -XX:+UseJVMCICompiler" \ JTREG_OPTIONS="-e:JVMCI_VERSION_CHECK=ignore" \ TEST=open/test/hotspot/jtreg/compiler/intrinsics/bmi/TestLzcntL.java ============================== Test summary ============================== TEST TOTAL PASS FAIL ERROR jtreg:open/test/hotspot/jtreg/compiler/intrinsics/bmi/TestLzcntL.java 1 1 0 0 ============================== TEST SUCCESS
06-12-2024

Reassiging to [~yzheng] We should fix this by adding --add-modules=jdk.internal.vm.ci to the mach5 test definitions that launch the tier9-graal-tier5-rt-aot-XXX tasks.
06-12-2024

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/22596 Date: 2024-12-06 05:52:49 +0000
06-12-2024

Even if JDK-8345635 is fixed, the TestLzcntL.java test will still fail, because the process that runs with -Xint will not be compatible with the jdk.aotcache file, so we will again get the output mismatch. To work around this problem, we should add -Xlog:cds=off to both processes, so the [error][cds] message is not printed.
06-12-2024

The failure happens in the task tier9-graal-tier5-rt-aot-jdkcache-open_test_hotspot_jtreg_tier2_compiler-any-aarch64-debug-1350, which does this: [1] During the setup phase (RunTests.gmk - SetupAot), we create testoutput/test-support/jtreg_open_test_hotspot_jtreg_tier2_compiler/aot/jdk.aotcache with -XX:+UnlockExperimentalVMOptions -XX:+UseJVMCICompiler -XX:+AOTClassLinking. However, because of JDK-8345635, jdk.aotcache is created with AOTClassLinking enabled, but without using --add-modules=jdk.internal.vm.ci [2] All jtreg tests are executed. When a test like open/test/hotspot/jtreg/compiler/intrinsics/bmi/TestLzcntL.java is executed, it's run with additional VM options: -XX:AOTCache=./testoutput/test-support/jtreg_open_test_hotspot_jtreg_tier2_compiler/aot/jdk.aotcache \ -XX:+UnlockExperimentalVMOptions \ -XX:+UseJVMCICompiler The -XX:+UseJVMCICompiler cause --add-modules=jdk.internal.vm.ci to be added. So the module configuration is different than what jdk.aotcache expects. As a result, jdk.aotcache cannot be loaded, and the error message is printed [error][cds] CDS archive has aot-linked classes. It cannot be used when archived full module graph is not used. [3] TestLzcntL.java spawns two separate JVM processes. One with -Xint and the other with -Xcomp. The error message is printed only for the second process (as -Xint effectively disables -XX:+UseJVMCICompiler. [4] Because the test requires the two processes to print identical output, it fails. https://github.com/openjdk/jdk/blob/84032850dbe3add7b7c8d6a4b2fbd5d5cab4483a/test/hotspot/jtreg/compiler/intrinsics/bmi/BMITestRunner.java#L97-L100
06-12-2024

I believe this will go away when JDK-8266329 is resolved. Until then, these tests should not be run with -XX:+AOTClassLinking when JVMCI is enabled. cc [~iklam]
21-11-2024