Just-Ahead-of-Time (JAOT) compiler technology used in the Real-time JRE (RTJRE)  provides performance benefits of JIT compiler, while abiding to the strict timing requirements of real-time Java applications.  JAOT pre-compiles Java method bytecodes at the application startup, thus removing non-deterministic nature of JIT compilation and possibility of missing application deadlines.

The JAOT or AOT (Ahead-of-Time) compilers used with Real-time JREs do not possess, when invoked, enough knowledge about Java applications to decide which of their bytecode methods should be compiled and which should not (compiling all methods would result in long startup time and large memory overhead).  To resolve this, Apogee's JAOT compiler has 2 modes of execution: analyze/file and fuzzy.
  • In the 'analyze/file' mode, the compiler analyzes the JAR file(s) of a given Java application and produces a list of 'hot' bytecode methods that should be compiled into native code. The produced list is then used when the compiler is subsequently invoked in the 'file' mode to compile all listed methods into native methods before the 'main' method of the application is invoked.

  • In the fuzzy mode, the compiler creates a tree of reachable bytecode methods of a selected depth.  Then, starting with the 'main' method, the compiler analyzes the java bytecode of the methods to determine which of them may be invoked when the application is executed, and selects those that should be compiled. Finally, the selected methods are compiled into native methods before the 'main' method of the application is invoked.
JAOT behavior and modes are controlled via -Xjaot[:opt=val] directive, where available options include:

 Option  Description
 (no option)
 equivalent to fuzzy=8
 fuzzy[=<depth>]  use fuzzy mode, with default depth=8. If <depth> is -1, depth is considered unlimited and all reachable methods are compiled.
 analyze[=<file>]
 use analyze mode to generate a list of hot methods without any precompilation.  If <file> is not specified, main application class name is used with extension .jaot
 file[=<file>]
 use file mode to precompile a list of hot methods specified in <file>.  If <file> is not specified, main application class name is used with extension .jaot
 verbose  write statistical information to stdout