JDK-8211935 : [Graal] AOTed JVMCI causes exception and doesnt run
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 12
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • CPU: generic
  • Submitted: 2018-10-09
  • Updated: 2023-07-21
  • Resolved: 2023-07-21
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 12
12Resolved
Related Reports
Duplicate :  
Relates :  
Description
While running some JMH where graal, java.base, and jvmci are AOTed, an exception happens:

# Run progress: 0.00% complete, ETA 00:08:20
# Fork: 1 of 5
Uncaught exception at /home/eric/tmp/jenkins/workspace/Buijladv-aj.dlka-nngi.gNhotCllya-swsiDtehf-FAoOuTn-dDEerlrl/ojrd:k /oorpen/src/hotsgpo/tg/rasahlavrme//cjovmmpciil/ejrv/mhcoitCsopmopti/lHeort.Scppopt:G1r4a1a
lJVMCIServiceLocator$Shared
	at jdk.internal.vm.compiler@12-internal/org.graalvm.compiler.hotspot.HotSpotGraalJVMCIServiceLocator.getProvider(HotSpotGraalJVMCIServiceLocator.java:67)
	at jdk.internal.vm.ci/jdk.vm.ci.services.JVMCIServiceLocator.getProviders(JVMCIServiceLocator.java:88)
	at jdk.internal.vm.ci/jdk.vm.ci.hotspot.HotSpotJVMCICompilerConfig.getCompilerFactory(HotSpotJVMCICompilerConfig.java:91)
	at jdk.internal.vm.ci/jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.<init>(HotSpotJVMCIRuntime.java:297)
	at jdk.internal.vm.ci/jdk.vm.ci.hotspot.HotSpotJVMCIRuntime$DelayedInit.<clinit>(HotSpotJVMCIRuntime.java:80)
	at jdk.internal.vm.ci/jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.runtime(HotSpotJVMCIRuntime.java:96)
	at jdk.internal.vm.ci/jdk.vm.ci.runtime.JVMCI.initializeRuntime(Native Method)
	at jdk.internal.vm.ci/jdk.vm.ci.runtime.JVMCI.<clinit>(JVMCI.java:58)
<forked VM failed with exit code 255>
<stdout last='20 lines'>
Uncaught exception at /home/eric/tmp/jenkins/workspace/Build-jdk-nightly-with-AOT-Dell/jdk/open/src/hotspot/share/jvmci/jvmciCompiler.cpp:141
</stdout>
<stderr last='20 lines'>
java.lang.NoClassDefFoundError: org/graalvm/compiler/hotspot/HotSpotGraalJVMCIServiceLocator$Shared
	at jdk.internal.vm.compiler@12-internal/org.graalvm.compiler.hotspot.HotSpotGraalJVMCIServiceLocator.getProvider(HotSpotGraalJVMCIServiceLocator.java:67)
	at jdk.internal.vm.ci/jdk.vm.ci.services.JVMCIServiceLocator.getProviders(JVMCIServiceLocator.java:88)
	at jdk.internal.vm.ci/jdk.vm.ci.hotspot.HotSpotJVMCICompilerConfig.getCompilerFactory(HotSpotJVMCICompilerConfig.java:91)
	at jdk.internal.vm.ci/jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.<init>(HotSpotJVMCIRuntime.java:297)
	at jdk.internal.vm.ci/jdk.vm.ci.hotspot.HotSpotJVMCIRuntime$DelayedInit.<clinit>(HotSpotJVMCIRuntime.java:80)
	at jdk.internal.vm.ci/jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.runtime(HotSpotJVMCIRuntime.java:96)
	at jdk.internal.vm.ci/jdk.vm.ci.runtime.JVMCI.initializeRuntime(Native Method)
	at jdk.internal.vm.ci/jdk.vm.ci.runtime.JVMCI.<clinit>(JVMCI.java:58)
</stderr>

# Run complete. Total time: 00:00:00

REMEMBER: The numbers below are just data. To gain reusable insights, you need to follow up on
why the numbers are the way they are. Use profilers (see -prof, -lprof), design factorial
experiments, perform baseline and negative tests that provide experimental control, make sure
the benchmarking environment is safe on JVM/OS/HW level, ask for reviews from the domain experts.
Do not assume the numbers tell you what you want them to tell.

Benchmark  Mode  Cnt  Score   Error  Units

Comments
Will be delivered in the next Graal update
18-10-2018

Fixed upstream: https://github.com/oracle/graal/commit/1fc1a8390e7bc7dbe9b8c4ce9ed97119262976d8
18-10-2018

ILW = Incorrect execution of compiled code (exception is thrown), with AOT'ed Graal, java.base and jvmci, don't use AOT = HLM = P3
10-10-2018

The exception is thrown from a class initialization call. This should have a very much fixed position in the graph. Not sure why would the failure happen...
09-10-2018

Problematic method: jdk.vm.ci.services.JVMCIServiceLocator.getProviders(Ljava/lang/Class;)Ljava/util/List; The immediately obvious problem, is that we call to runtime to resolve "Lorg/graalvm/compiler/hotspot/HotSpotGraalJVMCIServiceLocator$Shared;" and it fails and we throw an exception. Prior to JDK-8206992 that contains my fix to forward exceptions during initialization we would silently deopt and retry in the interpreter. Now we don't and just forward the exception. Also, we seem to be inlining HotSpotGraalJVMCIServiceLocator.getProvider() into JVMCIServiceLocator.getProviders(), which is odd, we seem to use profiling information? We should be ignoring it.
09-10-2018

[~iveresov] please, look Failed in static access: void onCompilerCreation(HotSpotGraalCompiler compiler) { Shared.SINGLETON.onCompilerCreation(compiler); } public final class HotSpotGraalJVMCIServiceLocator extends JVMCIServiceLocator { /** * Holds the state shared between all {@link HotSpotGraalJVMCIServiceLocator} instances. This is * necessary as a service provider instance is created each time the service is loaded. */ private static final class Shared { static final Shared SINGLETON = new Shared();
09-10-2018

I verified that jdk12 build 7 before JDK-8206992 changes passed. Build 8, which includes JDK-8206992, failed. To reproduce: jaotc --info --module jdk.internal.vm.ci --output libjvmci.so java -XX:AOTLibrary=./libjvmci.so -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:+UseJVMCICompiler -XX:+EagerJVMCI -version Error occurred during initialization of VM java.lang.NoClassDefFoundError: org/graalvm/compiler/hotspot/HotSpotGraalJVMCIServiceLocator$Shared at org.graalvm.compiler.hotspot.HotSpotGraalJVMCIServiceLocator.getProvider(jdk.internal.vm.compiler@12-ea/HotSpotGraalJVMCIServiceLocator.java:67) at jdk.vm.ci.services.JVMCIServiceLocator.getProviders(jdk.internal.vm.ci@12-ea/JVMCIServiceLocator.java:88) at jdk.vm.ci.hotspot.HotSpotJVMCICompilerConfig.getCompilerFactory(jdk.internal.vm.ci@12-ea/HotSpotJVMCICompilerConfig.java:91) at jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.<init>(jdk.internal.vm.ci@12-ea/HotSpotJVMCIRuntime.java:297) at jdk.vm.ci.hotspot.HotSpotJVMCIRuntime$DelayedInit.<clinit>(jdk.internal.vm.ci@12-ea/HotSpotJVMCIRuntime.java:80) at jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.runtime(jdk.internal.vm.ci@12-ea/HotSpotJVMCIRuntime.java:96) at jdk.vm.ci.runtime.JVMCI.initializeRuntime(jdk.internal.vm.ci@12-ea/Native Method) at jdk.vm.ci.runtime.JVMCI.<clinit>(jdk.internal.vm.ci@12-ea/JVMCI.java:58)
09-10-2018