The ahead-of-time compiler

Ahead-of-Time (AOT) compilation allows you to compile Java classes and methods before you run your code. AOT compilation avoids the unpredictable timing effect the JIT compiler can have on sensitive performance paths. To ensure your code is compiled before it executes and for the highest level of deterministic performance, you can precompile your code into a shared class cache using the AOT compiler.

Note: AOT-compiled code does not typically run as quickly as JIT compiled code.

The Just-In-Time (JIT) compiler runs as a high-priority SCHED_OTHER thread, running above the priority of standard Java threads, but running below the priority of real-time threads. Just-in-time compilation, therefore, does not cause nondeterministic delays in real-time code. As a result, important real-time work is performed on-time because it won't be preempted by the JIT compiler. Real-time code might run as interpreted code, however, because the JIT has not had enough time to compile the hot methods that have queued up. A comparison is shown, Figure 1.

In general, if your application has a warm-up phase, it is more efficient to run with the JIT and, if necessary, disable the JIT when the warm-up phase is complete. This approach allows the JIT compiler to generate code for the environment in which your application runs.

If the application has no warm-up phase and it is not clear if key paths of execution are compiled through standard application operation, AOT compilation works well in this environment.

Figure 1. Comparing JIT compiler and AOT compiler.


© Copyright IBM Corporation 2005, 2010. All Rights Reserved.
© Copyright Sun Microsystems, Inc. 1997, 2007, 901 San Antonio Rd., Palo Alto, CA 94303 USA. All rights reserved.
US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
This information center is powered by Eclipse technology. (http://www.eclipse.org/)