Escape Analysis in the Context of Dynamic Compilation and Deoptimization

Thomas Kotzmann
Institute for System Software


Escape analysis is used in compilers to identify and optimize the allocation of objects that are accessible only within the allocating method or thread. This thesis presents a new intra- and interprocedural analysis for a dynamic compiler, which has to cope with dynamic class loading and deoptimization.

The analysis was implemented for Sun Microsystems' Java HotSpot™ client compiler. It operates on an intermediate representation in SSA form and introduces equi-escape sets for the efficient propagation of escape information between related objects. Analysis results are used for scalar replacement of fields, stack allocation of objects and synchronization removal. The interprocedural analysis supports the compiler in inlining decisions and allows actual parameters to be allocated in the stack frame of the caller. A lightweight bytecode analysis produces interprocedural escape information for methods that have not been compiled yet.

Dynamic class loading possibly invalidates the generated machine code. In this case, the execution of a method is continued in the interpreter. This is called deoptimization. Since the interpreter does not know about scalar replacement, stack allocation or synchronization removal, the deoptimization framework was extended to reallocate and relock objects on demand.

PhD thesis, Johannes Kepler University Linz, October 2005

Download as PDF