Run JVM-based Languages with GraalVM Enterprise

By definition, GraalVM Enterprise is a virtual machine and one of its function is to run JVM-based applications. GraalVM Enterprise can provide benefits by ensuring the extensibility via scripting languages. A new just-in-time compilation technology of GraalVM can make Java applications perform faster. The compiler of GraalVM assures performance advantages for highly abstracted programs due to its ability to remove costly object allocations.

Disclaimer: Oracle GraalVM Enterprise Edition 19 is developed on top of Java SE 8. The documentation provided here contains only material that makes GraalVM Enterprise distinctive from the base. The basic syntax to launch a Java application remains the same:

java [options] class [arguments]

To execute a JAR file containing class and resource files for the application, specify -jar option followed by a JAR file name to be called:

java [options] -jar file.jar [arguments]

Options are command-line launcher options, when arguments after the class name or JAR file name are passed to the main function. By default, if the first argument is not an option, java command treats it as a class file name. The java command started from the command line takes arguments to control the application behavior. All java -help options are inherited from Java HotSpot, including the -XX options. See the latter with java -XX:+PrintFlagsFinal.

By running the java command included in GraalVM, you will by definition use the GraalVM just-in-time compiler – no extra configuration is needed.

To look deeper in operation modes of running JVM-based applications, continue to JVM Languages Reference page. The Java performance examples demonstrate how the GraalVM compiler achieves unsurpassed performance results.

Compiler Configuration Options

The GraalVM compiler configuration options can be used for configuring general settings, tuning performance or diagnosing problems.

There are two operating modes of the GraalVM compiler when used as a HotSpot JIT compiler:

To determine the difference between running the GraalVM compiler in a Native Image versus on the JVM, measure performance and troubleshoot the compiler, refer to the JVM Operations Manual.

General Options

Since the GraalVM compiler is an instantiation of a JVMCI compiler, there is a number of options for configuring JVMCI specific functionality:

Option and Default Value Description
-XX:+UseJVMCICompiler Disable the use of the GraalVM compiler as the top tier JIT compiler. This is useful when wanting to compare performance of the GraalVM compiler against the native JIT compilers.
-Dgraal.CompilerConfiguration=name Select the GraalVM compiler configuration to use. If omitted, the compiler configuration with the highest auto-selection priority is used. To see the set of available configurations, supply the value help to this option. The current configurations and their semantics are: enterprise produces highly optimized code with a possible trade-off to compilation time. This value is only available in GraalVM Enterprise. community produces reasonably optimized code with a faster compilation time. economy compiles as fast as possible with less optimal throughput of the generated code.
-Dgraal.ShowConfiguration=none Print information about the GraalVM compiler configuration selected. The accepted values for this option are: none - shows no information. info - prints one line of output showing the name of the compiler configuration in use and the location it is loaded from.verbose - prints detailed compiler configuration information. This option only produces output when the GraalVM compiler is initialized. By default, the GraalVM compiler is initialized on the first top-tier compilation. For this reason, use this option as follows: java -XX:+EagerJVMCI -Dgraal.ShowConfiguration=info -version
-Dgraal.MitigateSpeculativeExecutionAttacks=None Select a strategy to mitigate speculative execution attacks (e.g., SPECTRE). Accepted values are: None - no mitigations are used in JIT compiled code. AllTargets - all branches are protected against speculative attacks. This has a large performance impact. GuardTargets - only branches that preserve Java memory safety are protected. This has reduced performance impact. NonDeoptGuardTargets - same as GuardTargets except that branches which deoptimize are not protected since they can not be executed repeatedly.

Performance Tuning Options

Option and Default Value Description
-Dgraal.OptDuplication=true This can be used to disable the path duplication optimization. This option is only available in GraalVM Enterprise.
-Dgraal.UsePriorityInlining=true This can be used to disable use of the advanced inlining algorithm that favors throughput over compilation speed. This option is only available in GraalVM Enterprise.
-Dgraal.Vectorization=true This can be used to disable the auto vectorization optimization. This option is only available in GraalVM Enterprise.
-Dgraal.TraceInlining=false Enable tracing of inlining decisions. This can be used for advanced tuning where it may be possible to change the source code of the program. For example: compilation of java.lang.Character.toUpperCaseEx(int): at java.lang.Character.toUpperCaseEx( [bci: 22]: ├──<GraphBuilderPhase> java.lang.CharacterData.of(int): no, bytecode parser did not replace invoke └──<PriorityInliningPhase> java.lang.CharacterData.of(int): yes, worth inlining according to the cost-benefit analysis. at java.lang.Character.toUpperCaseEx( [bci: 26]

Diagnostic Options

Option and Default Value Description
-Dgraal.CompilationFailureAction=Silent Specify the action to take when compilation fails by throwing an exception. The accepted values are: Silent - prints nothing to the console. Print - prints a stack trace to the console. Diagnose - retries the compilation with extra diagnostics enabled. On VM exit, the collected diagnostics are saved to a zip file that can be submitted along with a bug report. A message is printed to the console describing where the diagnostics file is saved: Graal diagnostic output saved in /Users/graal/graal_dumps/1549459528316/ ExitVM - same as Diagnose except that the VM process exits after retrying. For all values except for ExitVM, the VM continues executing.
-Dgraal.CompilationBailoutAsFailure=false The compiler may not complete compilation of a method due to some property or code shape in the method (e.g. exotic uses of the jsr and ret bytecodes). In this case the compilation treats this differently and bails out. If you want to be informed of such bailouts, this option makes the GraalVM compiler treats bailouts as failure and thus be subject to the action specified by the -Dgraal.CompilationFailureAction option.
-Dgraal.PrintCompilation=false Print an informational line to the console for each completed compilation. For example: HotSpotCompilation-11,Ljava/lang/Object;,wait,()V,|,591ms,12B,92B,4371kB HotSpotCompilation-175 Ljava/lang/String;,lastIndexOf,(II)I,|,590ms,126B,309B,4076kB HotSpotCompilation-184 Ljava/util/concurrent/ConcurrentHashMap;,setTabAt,([Ljava/util/concurrent/ConcurrentHashMap$Node;ILjava/util/concurrent/ConcurrentHashMap$Node;)V,|,591ms,38B,67B,3411kB HotSpotCompilation-136 Lsun/nio/cs/UTF_8$Encoder;,encode,([CII[B)I |,591ms,740B,418B,4921