# HG changeset patch # User Thomas Wuerthinger # Date 1305548952 -7200 # Node ID 07aa0a31fffb3d3a7344932e0d12a15f95912173 # Parent b9b0a0aa7ee8bb0e751e6ffb43c4d13c63a01da5 Rewrote frame state to be not-so-Java-specific. Clarified and reduced the usage of the term "node". diff -r b9b0a0aa7ee8 -r 07aa0a31fffb doc/design/graal_compiler.pdf Binary file doc/design/graal_compiler.pdf has changed diff -r b9b0a0aa7ee8 -r 07aa0a31fffb doc/design/graal_compiler.tex --- a/doc/design/graal_compiler.tex Mon May 16 14:05:15 2011 +0200 +++ b/doc/design/graal_compiler.tex Mon May 16 14:29:12 2011 +0200 @@ -195,14 +195,15 @@ \section{Control Flow} Control flow is managed in way where the predecessor node contains direct pointers to its successor nodes. +We reserve the term \textit{instruction} for nodes that are embedded in the control flow. This is opposite to the approach taken in the server compiler, where control flow and data flow edges point in the same direction. The advantage that we see in our approach is that there is no need for projection nodes in case of control flow splits. -An \texttt{If} node can directly point to its true and false successors without any intermediate nodes. +An \texttt{If} instruction can directly point to its true and false successors without any intermediate nodes. This makes the graph more compact and simplifies graph traversal. Listing \ref{lst:cfg2} shows an example Java program with an if statement where both paths do not contain any instruction with side effects. -The \texttt{If} instruction can directly point its true and false successors to a \texttt{Merge} node. -A \texttt{Phi} node that selects the appropriate value is appended to the \texttt{Merge} node. +The \texttt{If} instruction can directly point its true and false successors to a \texttt{Merge} instruction. +A \texttt{Phi} node that selects the appropriate value is appended to the \texttt{Merge} instruction. The \texttt{Return} instruction then has a data dependency on the \texttt{Phi} node. \begin{lstlisting}[label=lst:cfg2, caption=Control flow in the graph, captionpos=b] @@ -210,7 +211,6 @@ else { return 1; } \end{lstlisting} - \begin{figure}[h] \centering \begin{digraphenv}{scale=0.5}{cfg2} @@ -259,8 +259,6 @@ } catch(Exception e) { ... } \end{lstlisting} - - \begin{figure}[h] \centering \begin{digraphenv}{scale=0.5}{exc1} @@ -295,8 +293,8 @@ \label{sec:loops} Loops form a first-class construct in the IR that is expressed by specialized IR nodes during all optimization phases. We only compile methods with a control flow where every loop has a single entry point. -This entry point is a \nodename{LoopBegin} node. -This node is connected to a \nodename{LoopEnd} node that merges all control flow paths that do not exit the loop. +This entry point is a \nodename{LoopBegin} instruction. +This instruction is connected to a \nodename{LoopEnd} instruction that merges all control flow paths that do not exit the loop. The edge between the \nodename{LoopBegin} and the \nodename{LoopEnd} is the backedge of the loop. It goes from the beginning to the end in order to make the graph acyclic. An algorithm that traverses the control flow has to explicitely decide whether it wants to incorporate backedges (i.e., special case of the treatment of \nodename{LoopEnd}) or ignore them. @@ -326,7 +324,7 @@ \subsection{Loop Phis} Data flow in loops is modelled with special phi nodes at the beginning and the end of the loop. -The \nodename{LoopEnd} node merges every value that flows into the next loop iteration in associated \nodename{LoopEndPhi} nodes. +The \nodename{LoopEnd} instruction merges every value that flows into the next loop iteration in associated \nodename{LoopEndPhi} nodes. A corresponding \nodename{LoopBeginPhi} node that is associated with the loop header has a control flow dependency on the \nodename{LoopEndPhi} node. Listing \ref{lst:loop} shows a simple counting loop that is used as an example in the rest of this section. Figure \ref{fig:loop2} shows how the loop is modelled immediately after building the graph. @@ -335,8 +333,6 @@ for(int i=0; i