Scroll to navigation

JAOTC(1) JDK Commands JAOTC(1)

NAME

jaotc - The Java static compiler that produces native code for compiled Java methods

SYNOPSIS

jaotc [options] [name | list]

Command-line options separated by spaces. See jaotc Options.
The Java class or jar file from which Java methods will be compiled.
Colon (:) separated list of class names, modules, jar files or directories which contain class files.

DESCRIPTION

The jaotc command is a Java Ahead-Of-Time (AOT) static compiler which produces native code in the form of a shared library for the Java methods in specified Java class files. The Java Virtual Machine can load these AOT libraries and use native code from them when corresponding Java methods are called. By using jaotc, there is no need to wait for the JIT compiler to generate (by compiling bytecode) the fast native code for these Java methods. The code is already generated by jaotc and ready to be immediately used. For the same reason, there is no need to execute these methods in the Interpreter because fast compiled native code can be executed instead.

Note:

The jaotc command is experimental. See JEP 295: Ahead-of-Time Compilation [https://openjdk.java.net/jeps/295] for complete details.

JAOTC OPTIONS

Output file name. Default name is "unnamed.so".
List of Java classes to compile.
List of JAR files to compile.
List of Java modules to compile.
List of directories to search for files to compile.
List of directories to search for specified files.
Name of the file containing the compile commands:
Excludes compilation of specified methods.
Compiles only specified methods.

Regular expressions are used to specify classes and methods. For example:


exclude sun.util.resources..*.TimeZoneNames_.*.getContents\(\)\[\[Ljava/lang/Object; 
exclude sun.security.ssl.* 
compileOnly java.lang.String.*
Generates profiling code for tiered compilation. By default, profiling code is not generated (could be changed in a future).
Generates code with java assertions. By default, assertions code is not generated.
Sets the number of compilation threads used. The default value is min(16, available_cpus).
Ignores all exceptions thrown during class loading. By default, the tool will exit compilation if class loading throws an exception.
Exits on compilation errors. By default, failed compilation is skipped and compilation of other methods continues.
Prints information about compilation phases.
Prints more details about compilation phases.
Prints comprehensive details.
Prints a summary of standard options and exits the tool.
Prints version information.
Provides a flag to pass to the runtime system. To pass more than one flag, provide an instance of this option for each flag or flag argument needed.

JAOTC EXAMPLES

Use the jaotc tool to execute AOT compilation.


jaotc --output libHelloWorld.so HelloWorld.class

Specify a generated AOT library during application execution:


java -XX:+UnlockExperimentalVMOptions -XX:AOTLibrary=./libHelloWorld.so HelloWorld
2020 JDK 16