Generalization of Just-in-Time Trace Compilation for Java

Java source code is compiled to machine-independent bytecodes that are interpreted by a virtual machine. At run time, modern Java VMs use a just-in-time compiler (JIT compiler) to compile the most frequently executed methods to machine code while other methods continue to run in the interpreter. This leads to a good trade-off between execution speed and compilation overhead. As a further step in the same direction, it has been recently proposed to compile only certain paths through frequently executing loops while the rest of the program is interpreted. This is called trace compilation. It further reduces compilation times, allows for simpler and more aggressive optimizations, and makes compilers simple enough to run on resource-constrained devices.

Currently, trace compilation is restricted to paths through loops. However, there are also paths outside of loops which are executed frequently enough to justify their compilation to machine code. In other words, the concept of trace compilation can be generalized. The research goals of our project are therefore (1) to generalize the concept of the trace compilation by allowing traces to start and end anywhere in a program and by using techniques to split, merge, and glue traces together, (2) to abolish methods as execution units in compiled code and to replace them by traces that call each other using appropriate trace calling conventions, and (3) to investigate how traditional optimization techniques can be adapted and simplified for trace compilation.

We plan to integrate trace compilation into the Java HotSpot VM of Oracle, which is available from the open-source project OpenJDK.