Christian Wimmer

Phase Detection using Trace Compilation

Christian Wimmer, Marcelo S. Cintra, Michael Bebenita, Mason Chang, Andreas Gal, Michael Franz: Phase Detection using Trace Compilation. In Proceedings of the International Conference on Principles and Practice of Programming in Java, pages 172–181. ACM Press, 2009. doi:10.1145/1596655.1596683

Download as PDF
© ACM, 2009.


Dynamic compilers can optimize application code specifically for observed code behavior. Such behavior does not have to be stable across the entire program execution to be beneficial for optimizations, it must only be stable for a certain program phase. To specialize code for a program phase, it is necessary to detect when the execution behavior of the program changes (phase change). Trace-based compilation is an efficient method to detect such phase changes. A trace tree is a collection of frequently executed code paths through a code region, which is assembled dynamically at run time as the program executes. Program execution tends to remain within such a trace tree during a stable phase, whereas phase changes cause a sudden increase in side exits from the trace tree. Because trace trees are recorded at run time by observing the interpreter, the actual values of variables and expressions are also available. This allows a definition of phases based not only on recurring control flow, but also on recurring data values. The compiler can use constant values for variables that change their value rarely and rely on phase detection to handle the case when the variable value actually changes. Our evaluation shows that phase detection based on trace trees results in phases that match the intuitive expectation of a programmer and that are also useful for compiler optimizations.