[Native Image] GraalJITCompileAtRuntime fails to build with the Truffle runtime: hosted graph builder plugins reachable through Truffle.RUNTIME
Describe the Issue
-H:+GraalJITCompileAtRuntime (JIT compilation of bytecode loaded at run time by Crema) cannot be combined with the Truffle runtime: the image build fails because hosted-only graph builder plugins become reachable in the image heap through the Truffle compiler's configuration (Truffle.RUNTIME → SubstrateTruffleRuntime.truffleCompiler → TruffleCompilerImpl.config → TruffleCompilerConfiguration.plugins → GraphBuilderConfiguration$Plugins).
A plain application builds fine with the same flags; any image containing truffle-runtime fails, before any language code is involved.
Using the latest version of GraalVM can resolve many issues.
- I tried with the latest version of GraalVM.
GraalVM Version
Reproduced with both:
openjdk version "25.0.4.1.1" 2026-08-18
OpenJDK Runtime Environment GraalVM CE 25.4.4.1.1+1.1 (build 25.0.4.1.1+1-jvmci-25.4-b23)
OpenJDK 64-Bit Server VM GraalVM CE 25.4.4.1.1+1.1 (build 25.0.4.1.1+1-jvmci-25.4-b23, mixed mode, sharing)java version "25.0.4.1.1" 2026-08-18 LTS
Java(TM) SE Runtime Environment Oracle GraalVM 25.4.4.1.1-dev+1.1 (build 25.0.4.1.1+1-LTS-jvmci-25.4-b23)
Java HotSpot(TM) 64-Bit Server VM Oracle GraalVM 25.4.4.1.1-dev+1.1 (build 25.0.4.1.1+1-LTS-jvmci-25.4-b23, mixed mode, sharing)(Also reproduced on Oracle GraalVM 25.3.4.1.)
Operating System and Version
Linux x86_64Troubleshooting Confirmation
- I tried the suggestions in the troubleshooting guide.
Run Command
native-image -H:+UnlockExperimentalVMOptions -H:+RuntimeClassLoading -H:+GraalJITCompileAtRuntime -cp classes:$TRUFFLE_CP Main -o mainExpected Behavior
The image builds, and Truffle runtime compilation keeps working alongside JIT compilation of runtime-loaded bytecode (or the build rejects the combination with a clear message if it is unsupported).
Actual Behavior
The build fails during analysis with UnsupportedPlatformException: Type is not available in this platform for hosted plugin types (SubstitutionInvocationPlugins, SubstrateClassInitializationPlugin, DevirtualizeInterfaceCallPlugin).
Steps to Reproduce
Main.java:public final class Main { public static void main(String[] args) { System.out.println(com.oracle.truffle.api.Truffle.getRuntime().getName()); } }- Compile against the 25.4.4.1.1 Maven artifacts
truffle-api,truffle-runtime,truffle-compiler,polyglot,collections,word,nativeimage,jniutils($TRUFFLE_CP). - Build with
-H:+RuntimeClassLoadingonly: succeeds, and the binary prints the runtime name. - Build with
-H:+RuntimeClassLoading -H:+GraalJITCompileAtRuntime: fails as below. - A hello-world without Truffle on the class path builds with
-H:+RuntimeClassLoading -H:+GraalJITCompileAtRuntime.
Additional Context
No response
Build-Time Log Output and Error Messages
CE 25.4.4.1.1:
Error: com.oracle.graal.pointsto.constraints.UnsupportedPlatformException: Type is not available in this platform: com.oracle.svm.hosted.substitute.SubstitutionInvocationPlugins
Object was reached by
reading field jdk.graal.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration$Plugins.invocationPlugins of constant
jdk.graal.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration$Plugins@71fc3b0f: jdk.graal.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration$Plugins@71fc...
reading field jdk.graal.compiler.truffle.TruffleCompilerConfiguration.plugins of constant
jdk.graal.compiler.truffle.TruffleCompilerConfiguration@7ddb5435: jdk.graal.compiler.truffle.TruffleCompilerConfiguration@7ddb5435
reading field jdk.graal.compiler.truffle.TruffleCompilerImpl.config of constant
com.oracle.svm.truffle.api.SubstrateTruffleCompilerImpl@26e61207: com.oracle.svm.truffle.api.SubstrateTruffleCompilerImpl@26e61207
reading field com.oracle.truffle.runtime.OptimizedTruffleRuntime.truffleCompiler of constant
com.oracle.svm.truffle.api.SubstrateTruffleRuntime@4a9a0913: com.oracle.svm.truffle.api.SubstrateTruffleRuntime@4a9a0913
reading static field com.oracle.truffle.api.Truffle.RUNTIME
at <unknown-location>
(similar paths follow for SubstrateClassInitializationPlugin and DevirtualizeInterfaceCallPlugin)Source: oracle/graal