CAUTION: This site hosts draft documentation for the next release. For published content of the latest release, visit www.eclipse.org/openj9/docs

-Xaot / -Xnoaot

Use this option to control the behavior of the ahead-of-time (AOT) compiler.

AOT compilation allows the compilation of Java™ classes into native code for subsequent executions of the same program. The AOT compiler works with the class data sharing framework.

The AOT compiler generates native code dynamically while an application runs and caches any generated AOT code in the shared data cache. Subsequent VMs that execute the method can load and use the AOT code from the shared data cache without incurring the performance decrease experienced with JIT-compiled native code.

Performance

Because AOT code must persist over different program executions, AOT-generated code does not perform as well as JIT-generated code. AOT code usually performs better than interpreted code.

In a VM without an AOT compiler or with the AOT compiler disabled, the JIT compiler selectively compiles frequently used methods into optimized native code. There is a time cost associated with compiling methods because the JIT compiler operates while the application is running. Because methods begin by being interpreted and most JIT compilations occur during startup, startup times can be increased.

Startup performance can be improved by using the shared AOT code to provide native code without compiling. There is a small time cost to load the AOT code for a method from the shared data cache and bind it into a running program. The time cost is low compared to the time it takes the JIT compiler to compile that method.

Default behavior

The AOT compiler is enabled by default, but is only active when shared classes are enabled. By default, shared classes are disabled so that no AOT activity occurs.

When the AOT compiler is active, the compiler selects the methods to be AOT compiled with the primary goal of improving startup time.

Syntax

Setting Action Default
-Xaot Enable AOT yes
-Xaot:<parameter>[=<value>]{,<parameter>[=<value>]} Enable AOT with modifications
-Xnoaot Disable AOT

Parameters for -Xaot

Note: Although the AOT compiler is enabled by default, it is not active unless shared classes are enabled. Using this option on its own therefore has no effect. Use the -Xshareclasses option to enable shared classes.

You can concatenate several parameters by using commas.

Parameter Effect
count The number of times a method is called before it is compiled or loaded from an existing shared class cache.
exclude The method you want to exclude when AOT code is compiled or loaded from the shared classes cache.
limitFile Compile or load only the methods listed in the specified limit file.
loadExclude Do not load specified methods.
loadLimit Load specified methods only.
loadLimitFile Load only the methods listed in the specified limit file).
verbose Reports information about the AOT and JIT compiler configuration and method compilation.

count

    -Xaot:count=<n>
where <n> is the number of times a method is called before it is compiled or loaded from an existing shared class cache. For example, setting -Xaot:count=0 forces the AOT compiler to compile everything on first execution.

exclude

    -Xaot:exclude=<method>

where <method> is the Java method you want to exclude when AOT code is compiled or loaded from the shared classes cache.

Use this option if the method causes the program to fail.

limitFile

    -Xaot:limitFile=(<filename>,<m>,<n>)
Compile or load only the methods listed on lines <m> to <n> in the specified limit file (<filename>). Methods not listed in the limit file and methods listed on lines outside the range are not compiled or loaded.

loadExclude

    -Xaot:loadExclude=<method_prefix>
Do not load methods beginning with <method_prefix>.

loadLimit

    -Xaot:loadLimit=<method_prefix>
Load methods beginning with <method_prefix> only.

loadLimitFile

    -Xaot:loadLimitFile=(<filename>,<m>,<n>)
Load only the methods listed on lines <m> to <n> in the specified limit file (<filename>). Methods not listed in the limit file and methods listed on lines outside the range are not loaded.

verbose

    -Xaot:verbose
Reports information about the AOT and JIT compiler configuration and method compilation.

See also