Java Reference
In-Depth Information
FIGURE 6.5 A stack frame.
6.3 Our Translator
6.3.1 Organization of Our Translator
Our JVM-to-SPIM translator is based on those described by Christian Wimmer [Wimmer,
2004] and Hanspeter Mossenbock [Mossenbock, 2000], which are in turn versions of the Sun
(now Oracle) HotSpot Client Compiler. Our translator differs in several ways from those
described by Wimmer and Mossenbock, and while theirs produce native code for the Intel
86x, ours targets SPIM, a simulator for the MIPS32 architecture.
Roughly, the phases proceed as illustrated in Figure 6.6.
In the first phase, the JVM code is parsed and translated to a control-flow graph,
composed of basic blocks. A basic block consists of a linear sequence of instructions with
just one entry point at the start of the block, and one exit point at the end; otherwise, there
are no branches into or out of the block. The instructions are of a high level and preserve
the tree structure of expressions; following Wimmer, we call this a high-level intermediate
representation (HIR). Organizing the code in this way makes it more amenable to analysis.
In the second (optional) phase, various optimizations may be applied to improve the
code, making it faster and often smaller.
In the third phase, a lower-level representation of the code is constructed, assigning ex-
 
Search WWH ::




Custom Search