annotate graal/com.oracle.max.graal.doc.initial/graal_compiler.tex @ 2896:5d4aa5672d3d

Small fix to design document.
author Thomas Wuerthinger <thomas@wuerthinger.net>
date Wed, 08 Jun 2011 14:50:07 +0200
parents 5005a5607506
children 4db4e8cb6bd6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2517
8c6e31c62fba added initial version of design docs, fixed .hgignore (regex, . -> \.)
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
1 \documentclass[twocolumn]{svjour3}
2678
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
2 \usepackage{listings}
2517
8c6e31c62fba added initial version of design docs, fixed .hgignore (regex, . -> \.)
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
3 \usepackage[pdftex]{graphicx}
8c6e31c62fba added initial version of design docs, fixed .hgignore (regex, . -> \.)
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
4 \usepackage{environ}
8c6e31c62fba added initial version of design docs, fixed .hgignore (regex, . -> \.)
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
5 \usepackage{amsmath}
8c6e31c62fba added initial version of design docs, fixed .hgignore (regex, . -> \.)
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
6 \usepackage{amsfonts}
8c6e31c62fba added initial version of design docs, fixed .hgignore (regex, . -> \.)
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
7 \usepackage[english]{babel}
8c6e31c62fba added initial version of design docs, fixed .hgignore (regex, . -> \.)
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
8 \usepackage[utf8]{inputenc}
8c6e31c62fba added initial version of design docs, fixed .hgignore (regex, . -> \.)
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
9 \usepackage{lmodern}
8c6e31c62fba added initial version of design docs, fixed .hgignore (regex, . -> \.)
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
10 \usepackage[T1]{fontenc}
8c6e31c62fba added initial version of design docs, fixed .hgignore (regex, . -> \.)
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
11 \usepackage{color}
8c6e31c62fba added initial version of design docs, fixed .hgignore (regex, . -> \.)
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
12
8c6e31c62fba added initial version of design docs, fixed .hgignore (regex, . -> \.)
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
13 \input{graphdrawing}
8c6e31c62fba added initial version of design docs, fixed .hgignore (regex, . -> \.)
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
14
8c6e31c62fba added initial version of design docs, fixed .hgignore (regex, . -> \.)
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
15 \renewcommand*\descriptionlabel[1]{\hspace\labelsep\normalfont\bf #1}
8c6e31c62fba added initial version of design docs, fixed .hgignore (regex, . -> \.)
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
16
8c6e31c62fba added initial version of design docs, fixed .hgignore (regex, . -> \.)
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
17 \newcommand{\Sa}{{\Large$^*$}}
8c6e31c62fba added initial version of design docs, fixed .hgignore (regex, . -> \.)
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
18 \newcommand{\Sb}{{\Large$^\dag$}}
8c6e31c62fba added initial version of design docs, fixed .hgignore (regex, . -> \.)
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
19 \newcommand{\Sc}{{\Large$^\S$}}
8c6e31c62fba added initial version of design docs, fixed .hgignore (regex, . -> \.)
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
20
2562
0023bd42eefe comments
christian.wimmer@oracle.com
parents: 2561
diff changeset
21
0023bd42eefe comments
christian.wimmer@oracle.com
parents: 2561
diff changeset
22 \newcommand{\mynote}[2]{
0023bd42eefe comments
christian.wimmer@oracle.com
parents: 2561
diff changeset
23 \textcolor{red}{\fbox{\bfseries\sffamily\scriptsize#1}
0023bd42eefe comments
christian.wimmer@oracle.com
parents: 2561
diff changeset
24 {\small\textsf{\emph{#2}}}
0023bd42eefe comments
christian.wimmer@oracle.com
parents: 2561
diff changeset
25 \fbox{\bfseries\sffamily\scriptsize }}}
0023bd42eefe comments
christian.wimmer@oracle.com
parents: 2561
diff changeset
26
0023bd42eefe comments
christian.wimmer@oracle.com
parents: 2561
diff changeset
27 \newcommand\TODO[1]{\mynote{TODO}{#1}}
0023bd42eefe comments
christian.wimmer@oracle.com
parents: 2561
diff changeset
28 \newcommand\cw[1]{\mynote{CW}{#1}}
2576
c59db1f02893 doc: expanded framestate section
Lukas Stadler <lukas.stadler@jku.at>
parents: 2569
diff changeset
29 \newcommand\ls[1]{\mynote{LS}{#1}}
2573
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
30 \newcommand\nodename[1]{\texttt{#1}}
2562
0023bd42eefe comments
christian.wimmer@oracle.com
parents: 2561
diff changeset
31
2896
5d4aa5672d3d Small fix to design document.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2892
diff changeset
32 \hyphenpenalty=0
5d4aa5672d3d Small fix to design document.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2892
diff changeset
33 \doublehyphendemerits=0
5d4aa5672d3d Small fix to design document.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2892
diff changeset
34 \finalhyphendemerits=0
5d4aa5672d3d Small fix to design document.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2892
diff changeset
35 \clubpenalty10000
5d4aa5672d3d Small fix to design document.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2892
diff changeset
36 \widowpenalty10000
2562
0023bd42eefe comments
christian.wimmer@oracle.com
parents: 2561
diff changeset
37
0023bd42eefe comments
christian.wimmer@oracle.com
parents: 2561
diff changeset
38
2517
8c6e31c62fba added initial version of design docs, fixed .hgignore (regex, . -> \.)
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
39 \smartqed % flush right qed marks, e.g. at end of proof
8c6e31c62fba added initial version of design docs, fixed .hgignore (regex, . -> \.)
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
40
8c6e31c62fba added initial version of design docs, fixed .hgignore (regex, . -> \.)
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
41 \journalname{Graal Compiler Design}
8c6e31c62fba added initial version of design docs, fixed .hgignore (regex, . -> \.)
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
42 \def\makeheadbox{{%
8c6e31c62fba added initial version of design docs, fixed .hgignore (regex, . -> \.)
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
43 \hbox to0pt{\vbox{\baselineskip=10dd\hrule\hbox
8c6e31c62fba added initial version of design docs, fixed .hgignore (regex, . -> \.)
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
44 to\hsize{\vrule\kern3pt\vbox{\kern3pt
8c6e31c62fba added initial version of design docs, fixed .hgignore (regex, . -> \.)
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
45 \hbox{\bfseries The Graal Compiler - Design and Strategy}
8c6e31c62fba added initial version of design docs, fixed .hgignore (regex, . -> \.)
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
46 \kern3pt}\hfil\kern3pt\vrule}\hrule}%
8c6e31c62fba added initial version of design docs, fixed .hgignore (regex, . -> \.)
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
47 \hss}}}
8c6e31c62fba added initial version of design docs, fixed .hgignore (regex, . -> \.)
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
48
8c6e31c62fba added initial version of design docs, fixed .hgignore (regex, . -> \.)
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
49 \begin{document}
8c6e31c62fba added initial version of design docs, fixed .hgignore (regex, . -> \.)
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
50
2561
765dd54244a6 Updated doc. Added Texclipse project.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2517
diff changeset
51 \author{Thomas W\"{u}rthinger \Sa, Lukas Stadler \Sc, Gilles Duboscq \Sa}
2517
8c6e31c62fba added initial version of design docs, fixed .hgignore (regex, . -> \.)
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
52 \institute{\Sa Oracle, \Sc Johannes Kepler University, Linz}
8c6e31c62fba added initial version of design docs, fixed .hgignore (regex, . -> \.)
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
53
8c6e31c62fba added initial version of design docs, fixed .hgignore (regex, . -> \.)
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
54 \date{Created: \today}
8c6e31c62fba added initial version of design docs, fixed .hgignore (regex, . -> \.)
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
55
8c6e31c62fba added initial version of design docs, fixed .hgignore (regex, . -> \.)
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
56 \title{The Graal Compiler}
2604
c9b17ac5c06b Doc fixes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2598
diff changeset
57 \subtitle{Design and Strategy \\ \textcolor{red}{work in progress (Oracle internal)}}
2517
8c6e31c62fba added initial version of design docs, fixed .hgignore (regex, . -> \.)
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
58
8c6e31c62fba added initial version of design docs, fixed .hgignore (regex, . -> \.)
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
59 \maketitle
8c6e31c62fba added initial version of design docs, fixed .hgignore (regex, . -> \.)
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
60
2561
765dd54244a6 Updated doc. Added Texclipse project.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2517
diff changeset
61 \abstract{
2688
3396862d4cee Minor design doc edits.
Doug Simon <doug.simon@oracle.com>
parents: 2687
diff changeset
62 The Graal compiler (simply referred to as \emph{the compiler} in the rest of this document) aims at improving upon C1X, the Java port of the HotSpot client compiler, both in terms of modularity and peak performance.
2561
765dd54244a6 Updated doc. Added Texclipse project.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2517
diff changeset
63 The compiler should work with the Maxine VM and the HotSpot VM.
2589
795df30f979d Refer to "Graal compiler" as "the compiler" in the design document.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2588
diff changeset
64 This document contains information about the proposed design and strategy for developing the compiler.}
2561
765dd54244a6 Updated doc. Added Texclipse project.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2517
diff changeset
65
765dd54244a6 Updated doc. Added Texclipse project.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2517
diff changeset
66 \section{Context}
765dd54244a6 Updated doc. Added Texclipse project.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2517
diff changeset
67
2618
15774da89658 Incorporated comments from Peter. Renamings trap=>guard and guard/split=>anchor.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2604
diff changeset
68 In 2009, the Maxine team started with creating C1X, a Java port of the HotSpot client compiler, and integrated it into the Maxine VM.
2604
c9b17ac5c06b Doc fixes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2598
diff changeset
69 Part of this effort was the development of a clear and clean compiler-runtime interface that allows the separation of the compiler and the VM.
c9b17ac5c06b Doc fixes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2598
diff changeset
70 This compiler-runtime interface enables the use of one compiler for multiple VMs.
2561
765dd54244a6 Updated doc. Added Texclipse project.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2517
diff changeset
71 In June 2010, we started integrating C1X into the HotSpot VM and we called the resulting system Graal~VM.
2618
15774da89658 Incorporated comments from Peter. Renamings trap=>guard and guard/split=>anchor.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2604
diff changeset
72 Currently, the Graal~VM is fully functional and runs benchmarks (SciMark, DaCapo) at a similar speed as the HotSpot client compiler.
2561
765dd54244a6 Updated doc. Added Texclipse project.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2517
diff changeset
73
765dd54244a6 Updated doc. Added Texclipse project.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2517
diff changeset
74 \section{Goals}
2589
795df30f979d Refer to "Graal compiler" as "the compiler" in the design document.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2588
diff changeset
75 The compiler effort aims at rewriting the high-level intermediate representation of C1X with two main goals:
2561
765dd54244a6 Updated doc. Added Texclipse project.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2517
diff changeset
76 \begin{description}
765dd54244a6 Updated doc. Added Texclipse project.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2517
diff changeset
77 \item[Modularity:] A modular design of the compiler should simplify the implementation of new languages, new back-ends, and new optimizations.
2618
15774da89658 Incorporated comments from Peter. Renamings trap=>guard and guard/split=>anchor.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2604
diff changeset
78 \item[Peak Performance:] A more powerful intermediate representation should enable the implementation of aggressive optimizations that impact the peak performance of the resulting machine code.
2561
765dd54244a6 Updated doc. Added Texclipse project.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2517
diff changeset
79 \end{description}
765dd54244a6 Updated doc. Added Texclipse project.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2517
diff changeset
80
765dd54244a6 Updated doc. Added Texclipse project.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2517
diff changeset
81 \section{Design}
2589
795df30f979d Refer to "Graal compiler" as "the compiler" in the design document.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2588
diff changeset
82 For the implementation of the compiler, we rely on the following design decisions:
2561
765dd54244a6 Updated doc. Added Texclipse project.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2517
diff changeset
83 \begin{description}
765dd54244a6 Updated doc. Added Texclipse project.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2517
diff changeset
84 \item[Graph Representation:]
2562
0023bd42eefe comments
christian.wimmer@oracle.com
parents: 2561
diff changeset
85 The compiler's intermediate representation is modeled as a graph with nodes that are connected with directed edges.
2561
765dd54244a6 Updated doc. Added Texclipse project.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2517
diff changeset
86 There is only a single node base class and every node has an associated graph object that does not change during the node's lifetime.
765dd54244a6 Updated doc. Added Texclipse project.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2517
diff changeset
87 Every node is serializable and has an id that is unique within its graph.
765dd54244a6 Updated doc. Added Texclipse project.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2517
diff changeset
88 Every edge is classified as either a control flow edge (anti-dependency) or a data flow edge (dependency) and represented as a simple pointer from the source node to the target node.
765dd54244a6 Updated doc. Added Texclipse project.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2517
diff changeset
89 It is possible to replace a node with another node without traversing the full graph.
2588
26ecba0ead6d Update on doc.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2578
diff changeset
90 The graph does not allow data flow edge cycles or control flow edge cycles.
2688
3396862d4cee Minor design doc edits.
Doug Simon <doug.simon@oracle.com>
parents: 2687
diff changeset
91 We achieve this by explicitly modeling loops (see Section~\ref{sec:loops}).
2561
765dd54244a6 Updated doc. Added Texclipse project.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2517
diff changeset
92 \item[Extensibility:]
2618
15774da89658 Incorporated comments from Peter. Renamings trap=>guard and guard/split=>anchor.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2604
diff changeset
93 The compiler is extensible by allowing developers to add new compiler phases and new node subclasses without modifying the compiler's sources.
15774da89658 Incorporated comments from Peter. Renamings trap=>guard and guard/split=>anchor.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2604
diff changeset
94 A node has an abstract way of expressing its semantics and new compiler phases can ask compiler nodes for their properties and capabilities.
2588
26ecba0ead6d Update on doc.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2578
diff changeset
95 We use the ``everything is an extension'' concept.
26ecba0ead6d Update on doc.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2578
diff changeset
96 Even standard compiler optimizations are internally modeled as extensions, to show that the extension mechanism exposes all necessary functionality.
2561
765dd54244a6 Updated doc. Added Texclipse project.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2517
diff changeset
97 \item[Detailing:]
765dd54244a6 Updated doc. Added Texclipse project.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2517
diff changeset
98 The compilation starts with a graph that contains nodes that represent the operations of the source language (e.g., one node for an array store to an object array).
765dd54244a6 Updated doc. Added Texclipse project.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2517
diff changeset
99 During the compilation, the nodes are replaced with more detailed nodes (e.g., the array store node is split into a null check, a bounds check, a store check, and a memory access).
765dd54244a6 Updated doc. Added Texclipse project.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2517
diff changeset
100 Compiler phases can choose whether they want to work on the earlier versions of the graph (e.g., escape analysis) or on later versions (e.g., null check elimination).
765dd54244a6 Updated doc. Added Texclipse project.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2517
diff changeset
101 \item[Generality:]
765dd54244a6 Updated doc. Added Texclipse project.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2517
diff changeset
102 The compiler does not require Java as its input.
2688
3396862d4cee Minor design doc edits.
Doug Simon <doug.simon@oracle.com>
parents: 2687
diff changeset
103 This is achieved by having a graph as the starting point of the compilation and not a Java bytecode array.
2561
765dd54244a6 Updated doc. Added Texclipse project.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2517
diff changeset
104 Building the graph from the Java bytecodes must happen before giving a method to the compiler.
2618
15774da89658 Incorporated comments from Peter. Renamings trap=>guard and guard/split=>anchor.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2604
diff changeset
105 This enables front-ends for different languages (e.g., Ruby or JavaScript) to provide their own graph.
2561
765dd54244a6 Updated doc. Added Texclipse project.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2517
diff changeset
106 Also, there is no dependency on a specific back-end, but the output of the compiler is a graph that can then be converted to a different representation in a final compiler phase.
765dd54244a6 Updated doc. Added Texclipse project.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2517
diff changeset
107 \end{description}
765dd54244a6 Updated doc. Added Texclipse project.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2517
diff changeset
108
765dd54244a6 Updated doc. Added Texclipse project.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2517
diff changeset
109 \section{Milestones}
2597
08cda6637103 More doc + conclusion.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2591
diff changeset
110 \label{sec:mile}
2688
3396862d4cee Minor design doc edits.
Doug Simon <doug.simon@oracle.com>
parents: 2687
diff changeset
111 The compiler is being developed starting from the current C1X source code base.
3396862d4cee Minor design doc edits.
Doug Simon <doug.simon@oracle.com>
parents: 2687
diff changeset
112 This helps us test the compiler at every intermediate development step on a variety of Java benchmarks.
3396862d4cee Minor design doc edits.
Doug Simon <doug.simon@oracle.com>
parents: 2687
diff changeset
113 We define the following development milestones (see Section~\ref{sec:conclusions} for planned dates):
2561
765dd54244a6 Updated doc. Added Texclipse project.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2517
diff changeset
114 \begin{description}
2688
3396862d4cee Minor design doc edits.
Doug Simon <doug.simon@oracle.com>
parents: 2687
diff changeset
115 \item[M1:] We have a fully working Graal~VM version with a stripped down C1X compiler that does not perform any optimization.
2589
795df30f979d Refer to "Graal compiler" as "the compiler" in the design document.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2588
diff changeset
116 \item[M2:] We modified the high-level intermediate representation to be based on the compiler graph data structure.
795df30f979d Refer to "Graal compiler" as "the compiler" in the design document.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2588
diff changeset
117 \item[M3:] We have reimplemented and reenabled compiler optimizations in the compiler that previously existed in C1X.
795df30f979d Refer to "Graal compiler" as "the compiler" in the design document.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2588
diff changeset
118 \item[M4:] We have reintegrated the new compiler into the Maxine VM and can use it as a Maxine VM bootstrapping compiler.
2561
765dd54244a6 Updated doc. Added Texclipse project.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2517
diff changeset
119 \end{description}
765dd54244a6 Updated doc. Added Texclipse project.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2517
diff changeset
120
765dd54244a6 Updated doc. Added Texclipse project.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2517
diff changeset
121 After those four milestones, we see three different possible further development directions that can be followed in parallel:
765dd54244a6 Updated doc. Added Texclipse project.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2517
diff changeset
122 \begin{itemize}
2589
795df30f979d Refer to "Graal compiler" as "the compiler" in the design document.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2588
diff changeset
123 \item Removal of the XIR template mechanism and replacement with a snippet mechanism that works with the compiler graph.
795df30f979d Refer to "Graal compiler" as "the compiler" in the design document.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2588
diff changeset
124 \item Improvements for peak performance (loop optimizations, escape analysis, bounds check elimination, processing additional interpreter runtime feedback).
2604
c9b17ac5c06b Doc fixes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2598
diff changeset
125 \item Implementation of a prototype front-end for a different language, e.g., JavaScript.
2561
765dd54244a6 Updated doc. Added Texclipse project.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2517
diff changeset
126 \end{itemize}
765dd54244a6 Updated doc. Added Texclipse project.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2517
diff changeset
127
2678
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
128 \section{Project Source Structure}
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
129 In order to support the goal of a modular compiler, the code will be divided into the following source code projects (as subprojects of \textbf{com.oracle.max.graal}).
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
130
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
131 \begin{description}
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
132 \item[graph] contains the abstract node implementation, the graph implementation and all the associated tools and auxiliary classes.
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
133 \item[nodes] contains the implementation of known basic nodes (e.g., phi nodes, control flow nodes, \ldots).
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
134 Additional node classes should go into separate projects and be specializations of the known basic nodes.
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
135 \item[java] contains code for building graphs from Java bytecodes and Java-specific nodes.
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
136 \item[opt] contains optimizations such as global value numbering or conditional constant propagation.
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
137 \item[compiler] contains the compiler, including:
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
138 \begin{itemize}
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
139 \item Scheduling of the compilation phases.
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
140 \item Implementation of the \emph{compiler interface} (CI).
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
141 \item Implementation of the final compilation phase that produces the low-level representation.
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
142 \item Machine code creation, including debug info.
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
143 \end{itemize}
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
144 \end{description}
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
145
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
146
2597
08cda6637103 More doc + conclusion.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2591
diff changeset
147 \section{Graph}
2589
795df30f979d Refer to "Graal compiler" as "the compiler" in the design document.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2588
diff changeset
148
2597
08cda6637103 More doc + conclusion.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2591
diff changeset
149 The \emph{intermediate representation}~(IR) of the compiler is designed as a directed graph.
2688
3396862d4cee Minor design doc edits.
Doug Simon <doug.simon@oracle.com>
parents: 2687
diff changeset
150 The graph allocates unique ids for new nodes and can be queried for the node corresponding to a given id as well as for an unordered list of nodes of the graph.
3396862d4cee Minor design doc edits.
Doug Simon <doug.simon@oracle.com>
parents: 2687
diff changeset
151 Graphs can manage side data structures (e.g. dominator trees and temporary schedules), which will be automatically invalidated and lazily recomputed whenever the graph changes. These side data structures will usually be understood by more than one optimization.
2589
795df30f979d Refer to "Graal compiler" as "the compiler" in the design document.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2588
diff changeset
152
2597
08cda6637103 More doc + conclusion.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2591
diff changeset
153 The nodes of the graph have the following properties:
2589
795df30f979d Refer to "Graal compiler" as "the compiler" in the design document.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2588
diff changeset
154 \begin{itemize}
2597
08cda6637103 More doc + conclusion.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2591
diff changeset
155 \item Each node is always associated with a single graph and this association is immutable.
08cda6637103 More doc + conclusion.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2591
diff changeset
156 \item Each node has an immutable id that is unique within its associated graph.
2604
c9b17ac5c06b Doc fixes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2598
diff changeset
157 \item Nodes can have a data dependency, which means that one node requires the result of another node as its input. The fact that the result of the first node needs to be computed before the second node can be executed introduces a partial order to the set of nodes.
2597
08cda6637103 More doc + conclusion.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2591
diff changeset
158 \item Nodes can have a control flow dependency, which means that the execution of one node will be followed by the execution of another node. This includes conditional execution, memory access serialization and other reasons, and again introduces a partial order to the set of nodes.
2589
795df30f979d Refer to "Graal compiler" as "the compiler" in the design document.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2588
diff changeset
159 \item Nodes can only have data and control dependencies to nodes which belong to the same graph.
2618
15774da89658 Incorporated comments from Peter. Renamings trap=>guard and guard/split=>anchor.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2604
diff changeset
160 \item Control dependencies and data dependencies each represent a \emph{directed acyclic graph} (DAG) on the same set of nodes. This means that data dependencies always point upwards, and control dependencies always point downwards in a drawing of the graph. Situations that normally incur cycles (like loops) are represented by special nodes (see Section~\ref{sec:loops}).
2619
1586b1b56f0c Fixed typo.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2618
diff changeset
161 \item Ordering between nodes is specified only to the extent which is required to correctly express the semantics of a given program. This gives the compiler flexibility for the possible scheduling of a node and therefore wiggle room for optimizations. For algorithms that require a fixed ordering of nodes, a temporary schedule can always be generated.
2597
08cda6637103 More doc + conclusion.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2591
diff changeset
162 \item Both data and control dependencies can be traversed in both directions, so that each node can be traversed in four directions (see Figure~\ref{fig:directions}):
2589
795df30f979d Refer to "Graal compiler" as "the compiler" in the design document.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2588
diff changeset
163 \begin{itemize}
795df30f979d Refer to "Graal compiler" as "the compiler" in the design document.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2588
diff changeset
164 \item \emph{inputs} are all nodes that this node has data dependencies on.
2604
c9b17ac5c06b Doc fixes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2598
diff changeset
165 \item \emph{usages} are all nodes whose inputs contain this node.
c9b17ac5c06b Doc fixes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2598
diff changeset
166 \item \emph{successors} are all nodes that have to be after this node in control flow.
c9b17ac5c06b Doc fixes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2598
diff changeset
167 \item \emph{predecessors} are all nodes whose successors contain this node.
2589
795df30f979d Refer to "Graal compiler" as "the compiler" in the design document.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2588
diff changeset
168 \end{itemize}
795df30f979d Refer to "Graal compiler" as "the compiler" in the design document.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2588
diff changeset
169 \item Only inputs and successors can be changed, and changes to them will update the usages and predecessors.
2597
08cda6637103 More doc + conclusion.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2591
diff changeset
170 \item Every node must be able to support cloning and serialization.
08cda6637103 More doc + conclusion.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2591
diff changeset
171 \item The edges of a node also define \textit{happens-before} and \textit{happens-after} relationships as shown in Figure~\ref{fig:directions}.
2589
795df30f979d Refer to "Graal compiler" as "the compiler" in the design document.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2588
diff changeset
172 \end{itemize}
795df30f979d Refer to "Graal compiler" as "the compiler" in the design document.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2588
diff changeset
173
2896
5d4aa5672d3d Small fix to design document.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2892
diff changeset
174 \begin{figure}[ht]
2597
08cda6637103 More doc + conclusion.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2591
diff changeset
175 \centering
08cda6637103 More doc + conclusion.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2591
diff changeset
176 \begin{digraphenv}{scale=0.5}{graphdirections}
08cda6637103 More doc + conclusion.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2591
diff changeset
177 \node{node1}{Node}
08cda6637103 More doc + conclusion.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2591
diff changeset
178 \textnode{inputs}{inputs}
08cda6637103 More doc + conclusion.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2591
diff changeset
179 \textnode{usages}{usages}
08cda6637103 More doc + conclusion.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2591
diff changeset
180 \textnode{successors}{successors}
08cda6637103 More doc + conclusion.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2591
diff changeset
181 \textnode{predecessors}{predecessors}
08cda6637103 More doc + conclusion.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2591
diff changeset
182 \data{node1}{inputs}
08cda6637103 More doc + conclusion.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2591
diff changeset
183 \control{node1}{successors}
08cda6637103 More doc + conclusion.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2591
diff changeset
184 \data{usages}{node1}
08cda6637103 More doc + conclusion.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2591
diff changeset
185 \control{predecessors}{node1}
08cda6637103 More doc + conclusion.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2591
diff changeset
186 \node{node2}{Node}
2604
c9b17ac5c06b Doc fixes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2598
diff changeset
187 \textnode{before}{happens-before}
c9b17ac5c06b Doc fixes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2598
diff changeset
188 \textnode{after}{happens-after}
2597
08cda6637103 More doc + conclusion.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2591
diff changeset
189 \data{node2}{before}
08cda6637103 More doc + conclusion.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2591
diff changeset
190 \control{node2}{after}
08cda6637103 More doc + conclusion.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2591
diff changeset
191 \data{after}{node2}
08cda6637103 More doc + conclusion.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2591
diff changeset
192 \control{before}{node2}
08cda6637103 More doc + conclusion.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2591
diff changeset
193 \end{digraphenv}
08cda6637103 More doc + conclusion.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2591
diff changeset
194 \caption{A node and its edges.}
2604
c9b17ac5c06b Doc fixes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2598
diff changeset
195 \label{fig:directions}
2597
08cda6637103 More doc + conclusion.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2591
diff changeset
196 \end{figure}
08cda6637103 More doc + conclusion.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2591
diff changeset
197
2687
77e106760633 Additional subsection on inlining.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2685
diff changeset
198 \subsection{Inlining}
77e106760633 Additional subsection on inlining.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2685
diff changeset
199 Inlining is always performed by embedding one graph into another graph.
77e106760633 Additional subsection on inlining.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2685
diff changeset
200 Nodes cannot be reassigned to another graph, they are cloned instead.
77e106760633 Additional subsection on inlining.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2685
diff changeset
201 Therefore, inlining is performed by copying and rewiring the nodes of the inlined method into the graph of the outer method.
77e106760633 Additional subsection on inlining.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2685
diff changeset
202 While the copying will decrease compilation performance, it enables us to cache the graph for the inlined method, optimize it independently from the outer method, and use the optimized graph for subsequent inlinings.
77e106760633 Additional subsection on inlining.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2685
diff changeset
203 We do not expect a significant negative impact on overall compilation performance.
77e106760633 Additional subsection on inlining.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2685
diff changeset
204
77e106760633 Additional subsection on inlining.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2685
diff changeset
205 We are able to perform the inlining at any point during the compilation of a method and can therefore selectively expand the inlining if a certain optimization turns out to depend on the inlining of a method.
77e106760633 Additional subsection on inlining.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2685
diff changeset
206 An example for this would be when the escape analysis finds out that a certain object only escapes because of one method call and this method call is not inlined, because the penalty was to high.
77e106760633 Additional subsection on inlining.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2685
diff changeset
207 In this case, we can chose to nevertheless inline the method in order to increase the chances for finding out that the object does not escape.
77e106760633 Additional subsection on inlining.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2685
diff changeset
208
2678
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
209 \section{Control Flow}
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
210
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
211 Control flow is managed in way where the predecessor node contains direct pointers to its successor nodes.
2679
07aa0a31fffb Rewrote frame state to be not-so-Java-specific. Clarified and reduced the usage of the term "node".
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2678
diff changeset
212 We reserve the term \textit{instruction} for nodes that are embedded in the control flow.
2678
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
213 This is opposite to the approach taken in the server compiler, where control flow and data flow edges point in the same direction.
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
214 The advantage that we see in our approach is that there is no need for projection nodes in case of control flow splits.
2679
07aa0a31fffb Rewrote frame state to be not-so-Java-specific. Clarified and reduced the usage of the term "node".
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2678
diff changeset
215 An \texttt{If} instruction can directly point to its true and false successors without any intermediate nodes.
2678
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
216 This makes the graph more compact and simplifies graph traversal.
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
217
2682
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
218 Listing~\ref{lst:cfg2} shows an example Java program with an if statement where both paths do not contain any instruction with side effects.
2896
5d4aa5672d3d Small fix to design document.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2892
diff changeset
219 Figure~\ref{fig:loopexits} shows the corresponding compiler graph.
2679
07aa0a31fffb Rewrote frame state to be not-so-Java-specific. Clarified and reduced the usage of the term "node".
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2678
diff changeset
220 The \texttt{If} instruction can directly point its true and false successors to a \texttt{Merge} instruction.
07aa0a31fffb Rewrote frame state to be not-so-Java-specific. Clarified and reduced the usage of the term "node".
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2678
diff changeset
221 A \texttt{Phi} node that selects the appropriate value is appended to the \texttt{Merge} instruction.
2678
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
222 The \texttt{Return} instruction then has a data dependency on the \texttt{Phi} node.
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
223
2682
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
224 \begin{lstlisting}[label=lst:cfg2, caption=Control flow in the graph., captionpos=b]
2678
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
225 if (condition) { return 0; }
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
226 else { return 1; }
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
227 \end{lstlisting}
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
228
2896
5d4aa5672d3d Small fix to design document.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2892
diff changeset
229 \begin{figure}[ht]
2678
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
230 \centering
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
231 \begin{digraphenv}{scale=0.5}{cfg2}
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
232 \textnode{entry}{Entry}
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
233 \textnode{condition}{condition}
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
234 \textnode{const0}{0}
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
235 \textnode{const1}{1}
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
236 \nodesplit{if}{If}
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
237 \control{entry}{if}
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
238 \controllabel{if:succ1}{merge}
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
239 \controllabel{if:succ2}{merge}
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
240 \data{if}{condition}
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
241 \node{merge}{Merge}
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
242 \node{return}{Return}
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
243 \nodetri{phi}{Phi}
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
244 \datalabel{phi:in1}{merge}
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
245 \datalabel{phi:in2}{const0}
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
246 \datalabel{phi:in3}{const1}
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
247 \data{return}{phi}
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
248 \control{merge}{return}
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
249 \end{digraphenv}
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
250 \caption{A simple loop with two exits.}
2896
5d4aa5672d3d Small fix to design document.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2892
diff changeset
251 \label{fig:loopexits}
2678
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
252 \end{figure}
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
253
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
254 \section{Exceptions}
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
255 \label{sec:Exceptions}
2597
08cda6637103 More doc + conclusion.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2591
diff changeset
256
2896
5d4aa5672d3d Small fix to design document.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2892
diff changeset
257 We do not throw runtime exceptions (e.g., \texttt{IndexOutOf\-BoundsException}, \texttt{Null\-Pointer\-Exception}, or \texttt{Out\-Of\-Memory\-Exception}), but deoptimize instead.
2678
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
258 This reduces the places in the compiled code where an exact bytecode location and debug information must be known.
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
259 Additionally, this greatly reduces the number of exception handler edges in the compiled code.
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
260 The main advantage of this technique is however, that we are free in moving around bounds checks, memory allocation, memory accesses with implicit null checks, etc.
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
261
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
262 There are only two kinds of instruction that need explicit exception edges, because they are the only instructions that can throw exceptions in compiled code: \texttt{Throw} instructions and \texttt{Invoke} instructions.
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
263 They are modelled as instructions with an additional control flow continuation that points to an \texttt{ExceptionDispatch} instruction.
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
264 The exception dispatch instruction decides based on the type of the exception object whether the control should flow to the catch handler or to another exception dispatch.
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
265 If there is no catch handler in the currently compiled method, then the control flows into the \texttt{Unwind} instruction that handles the exception by forwarding it to the caller.
2682
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
266 Listing~\ref{lst:exc1} shows an example Java program with nested try blocks and Figure \ref{fig:exc1} shows the corresponding compiler graph.
2678
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
267
2682
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
268 \begin{lstlisting}[label=lst:exc1, caption=Exception dispatch in the compiler graph., captionpos=b]
2678
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
269 try { m1();
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
270 try { m2();
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
271 } catch(ExtendedException e) { ... }
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
272 m3();
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
273 throw exception;
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
274 } catch(Exception e) { ... }
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
275 \end{lstlisting}
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
276
2896
5d4aa5672d3d Small fix to design document.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2892
diff changeset
277 \begin{figure}[ht]
2678
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
278 \centering
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
279 \begin{digraphenv}{scale=0.5}{exc1}
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
280 \textnode{entry}{Entry}
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
281 \textnode{catch1}{catch1}
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
282 \textnode{catch2}{catch2}
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
283 \nodesplit{m1}{Invoke m1}
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
284 \nodesplit{m2}{Invoke m2}
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
285 \nodesplit{m3}{Invoke m3}
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
286 \nodesplit{dispatch1}{ExceptionDispatch}
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
287 \nodesplit{dispatch2}{ExceptionDispatch}
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
288 \node{throw}{Throw}
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
289 \node{unwind}{Unwind}
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
290 \control{entry}{m1}
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
291 \controllabel{m1:succ1}{m2}
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
292 \controllabel{m1:succ2}{dispatch2}
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
293 \controllabel{m2:succ1}{m3}
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
294 \controllabel{m2:succ2}{dispatch1}
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
295 \controllabel{m3:succ1}{throw}
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
296 \controllabel{m3:succ2}{dispatch2}
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
297 \control{throw}{dispatch2}
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
298 \controllabel{dispatch1:succ2}{catch1}
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
299 \controllabel{dispatch1:succ1}{dispatch2}
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
300 \controllabel{dispatch2:succ2}{catch2}
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
301 \controllabel{dispatch2:succ1}{unwind}
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
302 \end{digraphenv}
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
303 \caption{A simple loop with two exits.}
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
304 \label{fig:exc1}
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
305 \end{figure}
2597
08cda6637103 More doc + conclusion.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2591
diff changeset
306
08cda6637103 More doc + conclusion.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2591
diff changeset
307 \section{Loops}
2588
26ecba0ead6d Update on doc.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2578
diff changeset
308 \label{sec:loops}
2618
15774da89658 Incorporated comments from Peter. Renamings trap=>guard and guard/split=>anchor.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2604
diff changeset
309 Loops form a first-class construct in the IR that is expressed by specialized IR nodes during all optimization phases.
15774da89658 Incorporated comments from Peter. Renamings trap=>guard and guard/split=>anchor.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2604
diff changeset
310 We only compile methods with a control flow where every loop has a single entry point.
2679
07aa0a31fffb Rewrote frame state to be not-so-Java-specific. Clarified and reduced the usage of the term "node".
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2678
diff changeset
311 This entry point is a \nodename{LoopBegin} instruction.
07aa0a31fffb Rewrote frame state to be not-so-Java-specific. Clarified and reduced the usage of the term "node".
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2678
diff changeset
312 This instruction is connected to a \nodename{LoopEnd} instruction that merges all control flow paths that do not exit the loop.
2573
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
313 The edge between the \nodename{LoopBegin} and the \nodename{LoopEnd} is the backedge of the loop.
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
314 It goes from the beginning to the end in order to make the graph acyclic.
2618
15774da89658 Incorporated comments from Peter. Renamings trap=>guard and guard/split=>anchor.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2604
diff changeset
315 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.
2573
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
316 Figure \ref{fig:loop1} shows a simple example with a loop with a single entry and two exits.
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
317
2896
5d4aa5672d3d Small fix to design document.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2892
diff changeset
318 \begin{figure}[ht]
2573
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
319 \centering
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
320 \begin{digraphenv}{scale=0.5}{layout1}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
321 \textnode{BeforeLoop}{Loop entry}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
322 \textnode{Exit1}{First loop exit}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
323 \textnode{Exit2}{Second loop exit}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
324 \nodesplit{LoopBegin}{LoopBegin}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
325 \node{LoopEnd}{LoopEnd}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
326 \nodesplit{If1}{If}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
327 \nodesplit{If2}{If}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
328 \controllabel{LoopBegin:succ1}{LoopEnd}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
329 \controllabel{LoopBegin:succ2}{If1}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
330 \controllabel{If1:succ1}{If2}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
331 \controllabel{If2:succ1}{LoopEnd}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
332 \controllabel{BeforeLoop}{LoopBegin}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
333 \controllabel{If1:succ2}{Exit1}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
334 \controllabel{If2:succ2}{Exit2}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
335 \end{digraphenv}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
336 \caption{A simple loop with two exits.}
2604
c9b17ac5c06b Doc fixes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2598
diff changeset
337 \label{fig:loop1}
2573
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
338 \end{figure}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
339
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
340 \subsection{Loop Phis}
2688
3396862d4cee Minor design doc edits.
Doug Simon <doug.simon@oracle.com>
parents: 2687
diff changeset
341 Data flow in loops is modeled with special phi nodes at the beginning and the end of the loop.
2679
07aa0a31fffb Rewrote frame state to be not-so-Java-specific. Clarified and reduced the usage of the term "node".
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2678
diff changeset
342 The \nodename{LoopEnd} instruction merges every value that flows into the next loop iteration in associated \nodename{LoopEndPhi} nodes.
2573
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
343 A corresponding \nodename{LoopBeginPhi} node that is associated with the loop header has a control flow dependency on the \nodename{LoopEndPhi} node.
2682
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
344 Listing~\ref{lst:loop} shows a simple counting loop that is used as an example in the rest of this section.
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
345 Figure~\ref{fig:loop2} shows how the loop is modelled immediately after building the graph.
2678
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
346
2682
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
347 \begin{lstlisting}[label=lst:loop, caption=Loop example that counts from 0 to n-1., captionpos=b]
2678
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
348 for(int i=0; i<n; ++i) { }
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
349 \end{lstlisting}
b9b0a0aa7ee8 Added addition sections on control flow and exceptions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2619
diff changeset
350
2896
5d4aa5672d3d Small fix to design document.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2892
diff changeset
351 \begin{figure}[ht]
2573
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
352 \centering
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
353 \begin{digraphenv}{scale=0.5}{layout2}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
354 \textnode{BeforeLoop}{Loop entry}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
355 \textnode{Exit}{Loop exit}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
356 \textnode{n}{n}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
357 \textnode{Constant0}{0}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
358 \textnode{Constant1}{1}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
359 \nodesplit{LoopBegin}{LoopBegin}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
360 \node{LoopEnd}{LoopEnd}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
361 \nodesplit{If1}{If}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
362 \controllabel{LoopBegin:succ1}{LoopEnd}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
363 \controllabel{LoopBegin:succ2}{If1}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
364 \nodebi{Compare}{&lt;}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
365 \nodebi{LoopBeginPhi}{LoopBeginPhi}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
366 \nodebi{Add}{+}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
367 \datalabel{Add:in1}{LoopBeginPhi}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
368 \datalabel{Add:in2}{Constant1}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
369 \nodebi{LoopEndPhi}{LoopEndPhi}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
370 \control{LoopBeginPhi}{LoopEndPhi}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
371 \data{LoopEndPhi:in1}{LoopEnd}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
372 \data{LoopEndPhi:in2}{Add}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
373 \datalabel{LoopBeginPhi:in1}{LoopBegin}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
374 \datalabel{LoopBeginPhi:in2}{Constant0}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
375 \datalabel{Compare:in1}{LoopBeginPhi}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
376 \datalabel{Compare:in2}{n}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
377 \data{If1}{Compare}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
378 \controllabel{If1:succ1}{LoopEnd}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
379 \controllabel{BeforeLoop}{LoopBegin}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
380 \controllabel{If1:succ2}{Exit}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
381 \end{digraphenv}
2589
795df30f979d Refer to "Graal compiler" as "the compiler" in the design document.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2588
diff changeset
382 \caption{Graph for a loop counting from 0 to n-1.}
2604
c9b17ac5c06b Doc fixes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2598
diff changeset
383 \label{fig:loop2}
2573
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
384 \end{figure}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
385
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
386 \subsection{Loop Counters}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
387 The compiler is capable of recognizing variables that are only increased within a loop.
2618
15774da89658 Incorporated comments from Peter. Renamings trap=>guard and guard/split=>anchor.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2604
diff changeset
388 A potential overflow of such a variable is prohibited with a guard before the loop (this is not necessary in this example, because the loop variable cannot overflow).
2573
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
389 Figure \ref{fig:loop3} shows the compiler graph of the example loop after the loop counter transformation.
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
390
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
391
2896
5d4aa5672d3d Small fix to design document.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2892
diff changeset
392 \begin{figure}[ht]
2573
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
393 \centering
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
394 \begin{digraphenv}{scale=0.5}{layout3}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
395 \textnode{BeforeLoop}{Loop entry}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
396 \textnode{Exit}{Loop exit}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
397 \textnode{n}{n}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
398 \textnode{Constant0}{0}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
399 \textnode{Constant1}{1}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
400 \nodesplit{LoopBegin}{LoopBegin}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
401 \node{LoopEnd}{LoopEnd}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
402 \nodesplit{If1}{If}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
403 \controllabel{LoopBegin:succ1}{LoopEnd}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
404 \controllabel{LoopBegin:succ2}{If1}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
405 \nodebi{Compare}{&lt;}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
406 \nodetri{LoopCounter}{LoopCounter}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
407 \datalabel{LoopCounter:in1}{LoopBegin}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
408 \datalabeltext{LoopCounter:in2}{Constant0}{init}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
409 \datalabeltext{LoopCounter:in3}{Constant1}{stride}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
410 \datalabel{Compare:in1}{LoopCounter}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
411 \datalabel{Compare:in2}{n}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
412 \data{If1}{Compare}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
413 \controllabel{If1:succ1}{LoopEnd}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
414 \controllabel{BeforeLoop}{LoopBegin}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
415 \controllabel{If1:succ2}{Exit}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
416 \end{digraphenv}
2589
795df30f979d Refer to "Graal compiler" as "the compiler" in the design document.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2588
diff changeset
417 \caption{Graph after loop counter transformation.}
2604
c9b17ac5c06b Doc fixes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2598
diff changeset
418 \label{fig:loop3}
2573
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
419 \end{figure}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
420
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
421 \subsection{Bounded Loops}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
422
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
423 If the total maximum number of iterations of a loop is fixed, then the loop is converted into a bounded loop.
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
424 The total number of iterations always denotes the number of full iterations of the loop with the control flowing from the loop begin to the loop end.
2604
c9b17ac5c06b Doc fixes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2598
diff changeset
425 If the total number of iterations is reached, the loop is exited directly from the loop header.
2573
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
426 In the example, we can infer from the loop exit with the comparison on the loop counter that the total number of iterations of the loop is limited to n.
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
427 Figure \ref{fig:loop4} shows the compiler graph of the example loop after the bounded loop transformation.
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
428
2896
5d4aa5672d3d Small fix to design document.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2892
diff changeset
429 \begin{figure}[ht]
2573
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
430 \centering
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
431 \begin{digraphenv}{scale=0.5}{layout4}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
432 \textnode{BeforeLoop}{Loop entry}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
433 \textnode{Exit}{Loop exit}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
434 \textnode{n}{n}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
435 \textnode{Constant0}{0}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
436 \textnode{Constant1}{1}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
437 \nodesplittri{LoopBegin}{BoundedLoopBegin}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
438 \node{LoopEnd}{LoopEnd}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
439 \controllabel{LoopBegin:succ1}{LoopEnd}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
440 \controllabel{LoopBegin:succ2}{LoopEnd}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
441 \controllabel{LoopBegin:succ3}{Exit}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
442 \nodetri{LoopCounter}{LoopCounter}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
443 \datalabel{LoopCounter:in1}{LoopBegin}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
444 \datalabeltext{LoopCounter:in2}{Constant0}{init}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
445 \datalabeltext{LoopCounter:in3}{Constant1}{stride}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
446 \data{LoopBegin}{n}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
447 \controllabel{BeforeLoop}{LoopBegin}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
448 \end{digraphenv}
2589
795df30f979d Refer to "Graal compiler" as "the compiler" in the design document.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2588
diff changeset
449 \caption{Graph after bounded loop transformation.}
2604
c9b17ac5c06b Doc fixes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2598
diff changeset
450 \label{fig:loop4}
2573
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
451 \end{figure}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
452
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
453 \subsection{Vectorization}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
454
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
455 If we have now a bounded loop with no additional loop exit and no associated phi nodes (only associated loop counters), we can vectorize the loop.
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
456 We replace the loop header with a normal instruction that produces a vector of values from 0 to the number of loop iterations minus 1.
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
457 The loop counters are replaced with \texttt{VectorAdd} and \texttt{VectorMul} nodes.
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
458 The vectorization is only possible if every node of the loop can be replaced with a corresponding vector node.
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
459 Figure \ref{fig:loop5} shows the compiler graph of the example loop after vectorization.
2604
c9b17ac5c06b Doc fixes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2598
diff changeset
460 The vector nodes all work on an ordered list of integer values and are subject to canonicalization and global value numbering like any other node.
2573
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
461
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
462
2896
5d4aa5672d3d Small fix to design document.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2892
diff changeset
463 \begin{figure}[ht]
2573
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
464 \centering
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
465 \begin{digraphenv}{scale=0.5}{layout5}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
466 \textnode{Entry}{Entry}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
467 \textnode{Exit}{Exit}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
468 \textnode{n}{n}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
469 \textnode{Constant0}{0}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
470 \textnode{Constant1}{1}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
471 \node{Vector}{Vector}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
472 \nodebi{VectorAdd}{VectorAdd}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
473 \nodebi{VectorMul}{VectorMul}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
474 \control{Entry}{Vector}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
475 \control{Vector}{Exit}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
476 \datalabel{VectorAdd:in1}{Vector}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
477 \datalabel{VectorAdd:in2}{Constant0}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
478 \datalabel{VectorMul:in1}{VectorAdd}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
479 \datalabel{VectorMul:in2}{Constant1}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
480 \data{Vector}{n}
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
481 \end{digraphenv}
2598
e4395464810e Made graphs smaller.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2597
diff changeset
482 \caption{Graph after vectorization.}
2604
c9b17ac5c06b Doc fixes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2598
diff changeset
483 \label{fig:loop5}
2573
6d99b909696d Documentation: More content and graphs on loops and vectorization.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2572
diff changeset
484 \end{figure}
2561
765dd54244a6 Updated doc. Added Texclipse project.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2517
diff changeset
485
2588
26ecba0ead6d Update on doc.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2578
diff changeset
486
2597
08cda6637103 More doc + conclusion.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2591
diff changeset
487 \section{Frame States}
2679
07aa0a31fffb Rewrote frame state to be not-so-Java-specific. Clarified and reduced the usage of the term "node".
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2678
diff changeset
488 A frame state captures the state of the program like it is seen in by an interpreter of the program.
07aa0a31fffb Rewrote frame state to be not-so-Java-specific. Clarified and reduced the usage of the term "node".
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2678
diff changeset
489 The frame state contains the information that is local to the current activation and will therefore disappear during SSA-form constructions or other compiler optimizations.
07aa0a31fffb Rewrote frame state to be not-so-Java-specific. Clarified and reduced the usage of the term "node".
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2678
diff changeset
490 For Java, the frame state is defined in terms of the Java bytecode specification (i.e., the values of the local variables, the operand stack, and the locked monitors).
07aa0a31fffb Rewrote frame state to be not-so-Java-specific. Clarified and reduced the usage of the term "node".
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2678
diff changeset
491 However, a frame state is not a concept specific to Java (e.g., the Crankshaft JavaScript engine uses frame states in their optimizing compiler to model the values of the AST interpreter).
07aa0a31fffb Rewrote frame state to be not-so-Java-specific. Clarified and reduced the usage of the term "node".
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2678
diff changeset
492
07aa0a31fffb Rewrote frame state to be not-so-Java-specific. Clarified and reduced the usage of the term "node".
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2678
diff changeset
493 Frame states are necessary to support the deoptimization of the program, which is the precondition for performing aggressive optimizations that use optimistic assumptions.
07aa0a31fffb Rewrote frame state to be not-so-Java-specific. Clarified and reduced the usage of the term "node".
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2678
diff changeset
494 Therefore every point in the optimizing compiler that may revert execution back to the interpreter needs a valid frame state.
07aa0a31fffb Rewrote frame state to be not-so-Java-specific. Clarified and reduced the usage of the term "node".
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2678
diff changeset
495 However, the point where the interpreter continues execution need not correspond exactly to the execution position of the compiled code, because many Java bytecode instructions can be safely reexecuted.
07aa0a31fffb Rewrote frame state to be not-so-Java-specific. Clarified and reduced the usage of the term "node".
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2678
diff changeset
496 Thus, frame states need only be generated for the states after instructions that cannot be reexecuted, because they modify the state of the program.
07aa0a31fffb Rewrote frame state to be not-so-Java-specific. Clarified and reduced the usage of the term "node".
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2678
diff changeset
497 Examples for such instructions are:
2561
765dd54244a6 Updated doc. Added Texclipse project.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2517
diff changeset
498
2576
c59db1f02893 doc: expanded framestate section
Lukas Stadler <lukas.stadler@jku.at>
parents: 2569
diff changeset
499 \begin{itemize}
2679
07aa0a31fffb Rewrote frame state to be not-so-Java-specific. Clarified and reduced the usage of the term "node".
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2678
diff changeset
500 \item Array stores (in Java bytecodes {\tt IASTORE, LASTORE, FASTORE, \\DASTORE, AASTORE, BASTORE, CASTORE, SASTORE})
07aa0a31fffb Rewrote frame state to be not-so-Java-specific. Clarified and reduced the usage of the term "node".
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2678
diff changeset
501 \item Field stores (in Java bytecodes {\tt PUTSTATIC, PUTFIELD})
07aa0a31fffb Rewrote frame state to be not-so-Java-specific. Clarified and reduced the usage of the term "node".
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2678
diff changeset
502 \item Method calls (in Java bytecodes {\tt INVOKEVIRTUAL, INVOKESPECIAL, \\INVOKESTATIC, INVOKEINTERFACE})
07aa0a31fffb Rewrote frame state to be not-so-Java-specific. Clarified and reduced the usage of the term "node".
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2678
diff changeset
503 \item Synchronization (in Java bytecodes {\tt MONITORENTER, MONITOREXIT})
2576
c59db1f02893 doc: expanded framestate section
Lukas Stadler <lukas.stadler@jku.at>
parents: 2569
diff changeset
504 \end{itemize}
2561
765dd54244a6 Updated doc. Added Texclipse project.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2517
diff changeset
505
2679
07aa0a31fffb Rewrote frame state to be not-so-Java-specific. Clarified and reduced the usage of the term "node".
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2678
diff changeset
506 Within the graph a frame state is represented as a node that is attached to the instruction that caused it to be generated using a control dependency (see Figure~\ref{fig:fs1}).
2598
e4395464810e Made graphs smaller.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2597
diff changeset
507 Frame states also have data dependencies on the contents of the state: the local variables and the expression stack.
2561
765dd54244a6 Updated doc. Added Texclipse project.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2517
diff changeset
508
2604
c9b17ac5c06b Doc fixes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2598
diff changeset
509 The frame state at the method beginning does not have to be explicitely in the graph, because it can always be reconstructed at a later stage.
2682
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
510 We save the frame state at control flow merges if there is at least one frame state on any control flow path between a node and its immediate dominator.
2604
c9b17ac5c06b Doc fixes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2598
diff changeset
511
2561
765dd54244a6 Updated doc. Added Texclipse project.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2517
diff changeset
512
2896
5d4aa5672d3d Small fix to design document.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2892
diff changeset
513 \begin{figure}[ht]
2578
Lukas Stadler <lukas.stadler@jku.at>
parents: 2577 2574
diff changeset
514 \centering
2576
c59db1f02893 doc: expanded framestate section
Lukas Stadler <lukas.stadler@jku.at>
parents: 2569
diff changeset
515 \begin{digraphenv}{scale=0.5}{fs1}
2577
ac2029d0898f doc: framestate and deopt changes
Lukas Stadler <lukas.stadler@jku.at>
parents: 2576
diff changeset
516 \nodetrisplit{store1}{ArrayStore}
ac2029d0898f doc: framestate and deopt changes
Lukas Stadler <lukas.stadler@jku.at>
parents: 2576
diff changeset
517 \nodebi{load1}{ArrayLoad}
2576
c59db1f02893 doc: expanded framestate section
Lukas Stadler <lukas.stadler@jku.at>
parents: 2569
diff changeset
518 \controllabel{store1:succ1}{load1}
2618
15774da89658 Incorporated comments from Peter. Renamings trap=>guard and guard/split=>anchor.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2604
diff changeset
519 \nodetrisplit{store2}{FieldStore}
2576
c59db1f02893 doc: expanded framestate section
Lukas Stadler <lukas.stadler@jku.at>
parents: 2569
diff changeset
520 \control{load1}{store2}
c59db1f02893 doc: expanded framestate section
Lukas Stadler <lukas.stadler@jku.at>
parents: 2569
diff changeset
521 end [shape=plaintext, label="...", width="2.0"]
c59db1f02893 doc: expanded framestate section
Lukas Stadler <lukas.stadler@jku.at>
parents: 2569
diff changeset
522 store2:succ1:s -> end:n [color=red];
c59db1f02893 doc: expanded framestate section
Lukas Stadler <lukas.stadler@jku.at>
parents: 2569
diff changeset
523 %
c59db1f02893 doc: expanded framestate section
Lukas Stadler <lukas.stadler@jku.at>
parents: 2569
diff changeset
524 \nodeframestate{fs1}{FrameState}
c59db1f02893 doc: expanded framestate section
Lukas Stadler <lukas.stadler@jku.at>
parents: 2569
diff changeset
525 \controllabel{store1:succ2}{fs1}
c59db1f02893 doc: expanded framestate section
Lukas Stadler <lukas.stadler@jku.at>
parents: 2569
diff changeset
526 \nodeframestate{fs2}{FrameState}
c59db1f02893 doc: expanded framestate section
Lukas Stadler <lukas.stadler@jku.at>
parents: 2569
diff changeset
527 \controllabel{store2:succ2}{fs2}
c59db1f02893 doc: expanded framestate section
Lukas Stadler <lukas.stadler@jku.at>
parents: 2569
diff changeset
528 \end{digraphenv}
2578
Lukas Stadler <lukas.stadler@jku.at>
parents: 2577 2574
diff changeset
529 \caption{Simple example using two frame states.}
2604
c9b17ac5c06b Doc fixes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2598
diff changeset
530 \label{fig:fs1}
2578
Lukas Stadler <lukas.stadler@jku.at>
parents: 2577 2574
diff changeset
531 \end{figure}
2576
c59db1f02893 doc: expanded framestate section
Lukas Stadler <lukas.stadler@jku.at>
parents: 2569
diff changeset
532
c59db1f02893 doc: expanded framestate section
Lukas Stadler <lukas.stadler@jku.at>
parents: 2569
diff changeset
533
2682
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
534 A deoptimization node needs a valid frame state that specifies the location and state where the interpreter should continue.
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
535 The algorithm for constructing frame states makes sure that every possible location in the graph has a well-defined frame state that can be used by a deoptimization instruction.
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
536 Therefore, there are no direct links between the deoptimization instruction and its frame state thus allowing the deoptimization instructions to move freely around.
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
537
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
538 \subsection{Partial Escape Analysis}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
539
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
540 A partial escape analysis can help to further reduce the number of frame states.
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
541 A field or array store does not create a new frame state, when the object that is modified did not have a chance to escape between its creation and the store.
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
542
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
543 Listing~\ref{lst:escape1} shows an example of a method that creates two \texttt{Point} objects, connects them, and returns them.
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
544 The object allocation of the first \texttt{Point} object does not need a frame state.
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
545 We can always reexecute the \texttt{NEW} bytecode again in the interpreter.
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
546 The \texttt{Point} object allocated by the compiler will then simply disappear after the next garbage collection.
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
547 The following field store is a thread-local memory store, because the \texttt{Point} object did not have any chance to escape.
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
548 Same applies to the assignment of the \texttt{next} field and the third field assignment.
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
549 Therefore, the whole method \texttt{getPoint} does not need an explicit frame state, because at any time during execution of this method, we can deoptimize and continue execution in the interpreter at the first bytecode of the method.
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
550
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
551 \begin{lstlisting}[label=lst:escape1, caption=Example method that needs no frame state., captionpos=b]
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
552 void getPoint() {
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
553 Point p = new Point();
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
554 p.x = 1;
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
555 p.next = new Point();
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
556 p.next.x = 2;
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
557 return p;
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
558 }
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
559 \end{lstlisting}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
560
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
561 The reduction of frame states makes it easier for the compiler to perform memory optimizations like memory access coalescing.
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
562 We believe that this reduction on frame states is the key to effective vectorization and other compiler optimizations where compilers of compilers of unmanaged languages have advantages.
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
563
2618
15774da89658 Incorporated comments from Peter. Renamings trap=>guard and guard/split=>anchor.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2604
diff changeset
564 \subsection{Guards}
2679
07aa0a31fffb Rewrote frame state to be not-so-Java-specific. Clarified and reduced the usage of the term "node".
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2678
diff changeset
565 A guard is a node that deoptimizes based on a conditional expression.
07aa0a31fffb Rewrote frame state to be not-so-Java-specific. Clarified and reduced the usage of the term "node".
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2678
diff changeset
566 Guards are not attached to a certain frame state, they can move around freely and will always use the correct frame state when the nodes are scheduled (i.e., the last emitted frame state).
2682
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
567 The node that is guarded by the deoptimization has a data dependency on the guard and the guard in turn has a data dependency on the condition.
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
568 A guard must not be moved above any \texttt{If} nodes.
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
569 Therefore, we use \texttt{Anchor} instructions after a control flow split and a data dependency from the guard to this anchor.
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
570 The anchor is the most distant instruction that is postdominated by the guarded instruction and the guard can be scheduled anywhere between those two nodes.
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
571 This ensures maximum flexibility for the guard instruction and guarantees that we only deoptimize if the control flow would have reached the guarded instruction (without taking exceptions into account).
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
572
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
573 To illustrate the strengths of this approach, we show the graph for the Java code snippet shown in \ref{lst:guard1}.
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
574 The example looks artificial, but in case of method inlining, this is a pattern that is not unlikely to be present in a normal Java program.
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
575 Figure \ref{fig:guard0} shows the compiler graph for the example method after graph building.
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
576 The field stores are both represented by a single instruction and the null check that is implicitely incorporated in the field store.
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
577
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
578 \begin{lstlisting}[label=lst:guard1, caption=Example method that demonstrates the strengths of modelling the guards explicitely., captionpos=b]
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
579 void init(Point p) {
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
580 if (p != null) {
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
581 p.x = 0;
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
582 }
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
583 p.y = 0;
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
584 }
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
585 \end{lstlisting}
2561
765dd54244a6 Updated doc. Added Texclipse project.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2517
diff changeset
586
2896
5d4aa5672d3d Small fix to design document.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2892
diff changeset
587 \begin{figure}[ht]
2682
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
588 \centering
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
589 \begin{digraphenv}{scale=0.5}{guard0}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
590 \textnode{entry}{Entry}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
591 \nodesplit{if}{If}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
592 \node{merge}{Merge}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
593 \node{return}{Return}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
594 \node{cmpnull}{NonNull}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
595 \textnode{p}{p}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
596 \textnode{const0}{0}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
597 \nodebisplit{store1}{FieldStore x}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
598 \nodebisplit{store2}{FieldStore y}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
599 \nodeframestate{fs1}{FrameState}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
600 \nodeframestate{fs2}{FrameState}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
601 \datalabel{store1:in1}{p}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
602 \datalabel{store2:in1}{p}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
603 \datalabel{store1:in2}{const0}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
604 \datalabel{store2:in2}{const0}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
605 \control{entry}{if}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
606 \data{if}{cmpnull}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
607 \controllabel{if:succ1}{merge}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
608 \controllabel{if:succ2}{store1}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
609 \controllabel{store1:succ1}{merge}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
610 \controllabel{store1:succ2}{fs1}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
611 \control{merge}{store2}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
612 \controllabel{store2:succ1}{return}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
613 \controllabel{store2:succ2}{fs2}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
614 \data{cmpnull}{p}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
615 \end{digraphenv}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
616 \caption{Initial graph with the two field stores.}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
617 \label{fig:guard0}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
618 \end{figure}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
619
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
620 Figure~\ref{fig:guard1} shows the example graph at a later compilation phase when the field store instructions are lowered to memory store instructions and explicitely modelled null check guards.
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
621 The guards are attached to anchor instructions that delimit their possible schedule.
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
622 The first guard must not be moved outside the \texttt{if} block; the second guard may be moved before the \texttt{If} instruction, because at this point it is already guaranteed that the second store is executed.
2598
e4395464810e Made graphs smaller.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2597
diff changeset
623
2896
5d4aa5672d3d Small fix to design document.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2892
diff changeset
624 \begin{figure}[ht]
2578
Lukas Stadler <lukas.stadler@jku.at>
parents: 2577 2574
diff changeset
625 \centering
2618
15774da89658 Incorporated comments from Peter. Renamings trap=>guard and guard/split=>anchor.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2604
diff changeset
626 \begin{digraphenv}{scale=0.5}{guard1}
2682
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
627 \textnode{entry}{Entry}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
628 \node{anchor1}{Anchor}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
629 \node{anchor2}{Anchor}
2576
c59db1f02893 doc: expanded framestate section
Lukas Stadler <lukas.stadler@jku.at>
parents: 2569
diff changeset
630 \nodesplit{if}{If}
c59db1f02893 doc: expanded framestate section
Lukas Stadler <lukas.stadler@jku.at>
parents: 2569
diff changeset
631 \node{merge}{Merge}
2682
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
632 \node{return}{Return}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
633 \node{cmpnull}{NonNull}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
634 \textnode{p}{p}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
635 \textnode{const0}{0}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
636 \nodeguard{guard1}{Guard}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
637 \nodeguard{guard2}{Guard}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
638 \nodetrisplit{store1}{MemStore 16 (int)}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
639 \nodetrisplit{store2}{MemStore 20 (int)}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
640 \nodeframestate{fs1}{FrameState}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
641 \nodeframestate{fs2}{FrameState}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
642 \data{store1:in1}{p}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
643 \data{store2:in1}{p}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
644 \data{store1:in2}{const0}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
645 \data{store2:in2}{const0}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
646 \data{store1:in3}{guard1}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
647 \data{store2:in3}{guard2}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
648 \data{guard1:in1}{anchor2}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
649 \data{guard2:in1}{anchor1}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
650 \data{guard1:in2}{cmpnull}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
651 \data{guard2:in2}{cmpnull}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
652 \control{entry}{anchor1}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
653 \control{anchor1}{if}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
654 \data{if}{cmpnull}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
655 \controllabel{if:succ1}{merge}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
656 \controllabel{if:succ2}{anchor2}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
657 \control{anchor2}{store1}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
658 \controllabel{store1:succ1}{merge}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
659 \controllabel{store1:succ2}{fs1}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
660 \control{merge}{store2}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
661 \controllabel{store2:succ1}{return}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
662 \controllabel{store2:succ2}{fs2}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
663 \data{cmpnull}{p}
2576
c59db1f02893 doc: expanded framestate section
Lukas Stadler <lukas.stadler@jku.at>
parents: 2569
diff changeset
664 \end{digraphenv}
2618
15774da89658 Incorporated comments from Peter. Renamings trap=>guard and guard/split=>anchor.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2604
diff changeset
665 \caption{A load guarded by a null check guard.}
15774da89658 Incorporated comments from Peter. Renamings trap=>guard and guard/split=>anchor.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2604
diff changeset
666 \label{fig:guard1}
2578
Lukas Stadler <lukas.stadler@jku.at>
parents: 2577 2574
diff changeset
667 \end{figure}
2576
c59db1f02893 doc: expanded framestate section
Lukas Stadler <lukas.stadler@jku.at>
parents: 2569
diff changeset
668
2682
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
669 The first guard can be easily removed, because it is guarded by an \texttt{If} instruction that checks the same condition.
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
670 Therefore we can remove the guard and the anchor from the graph and this gives us the graph shown in Figure \ref{fig:guard2}.
2576
c59db1f02893 doc: expanded framestate section
Lukas Stadler <lukas.stadler@jku.at>
parents: 2569
diff changeset
671
2682
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
672 There is another optimization for guard instructions: If two guards that are anchored to the true and false branch of the same \texttt{If} instruction have the same condition, they can be merged, so that the resulting guard is anchored at the most distant node of which the \texttt{If} instruction is a postdominator.
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
673
2598
e4395464810e Made graphs smaller.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2597
diff changeset
674
2896
5d4aa5672d3d Small fix to design document.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2892
diff changeset
675 \begin{figure}[ht]
2578
Lukas Stadler <lukas.stadler@jku.at>
parents: 2577 2574
diff changeset
676 \centering
2618
15774da89658 Incorporated comments from Peter. Renamings trap=>guard and guard/split=>anchor.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2604
diff changeset
677 \begin{digraphenv}{scale=0.5}{guard2}
2682
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
678 \textnode{entry}{Entry}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
679 \node{anchor1}{Anchor}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
680 \nodesplit{if}{If}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
681 \node{merge}{Merge}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
682 \node{return}{Return}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
683 \node{cmpnull}{NonNull}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
684 \textnode{p}{p}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
685 \textnode{const0}{0}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
686 \nodeguard{guard2}{Guard}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
687 \nodetrisplit{store1}{MemStore 16 (int)}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
688 \nodetrisplit{store2}{MemStore 20 (int)}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
689 \nodeframestate{fs1}{FrameState}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
690 \nodeframestate{fs2}{FrameState}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
691 \data{store1:in1}{p}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
692 \data{store2:in1}{p}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
693 \data{store1:in2}{const0}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
694 \data{store2:in2}{const0}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
695 \data{store2:in3}{guard2}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
696 \data{guard2:in1}{anchor1}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
697 \data{guard2:in2}{cmpnull}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
698 \control{entry}{anchor1}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
699 \control{anchor1}{if}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
700 \data{if}{cmpnull}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
701 \controllabel{if:succ1}{merge}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
702 \controllabel{if:succ2}{store1}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
703 \controllabel{store1:succ1}{merge}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
704 \controllabel{store1:succ2}{fs1}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
705 \control{merge}{store2}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
706 \controllabel{store2:succ1}{return}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
707 \controllabel{store2:succ2}{fs2}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
708 \data{cmpnull}{p}
2576
c59db1f02893 doc: expanded framestate section
Lukas Stadler <lukas.stadler@jku.at>
parents: 2569
diff changeset
709 \end{digraphenv}
2682
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
710 \caption{After removing redundant guards.}
2618
15774da89658 Incorporated comments from Peter. Renamings trap=>guard and guard/split=>anchor.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2604
diff changeset
711 \label{fig:guard2}
2578
Lukas Stadler <lukas.stadler@jku.at>
parents: 2577 2574
diff changeset
712 \end{figure}
2576
c59db1f02893 doc: expanded framestate section
Lukas Stadler <lukas.stadler@jku.at>
parents: 2569
diff changeset
713
2682
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
714 The remaining guard can now be moved above the \texttt{If} condition and be used to eliminate the need for the \texttt{If} node.
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
715 From this point on, the guard can however no longer be moved below the first memory store.
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
716 We use a control dependency from the guard to the field store to express this condition.
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
717 The link between the second store and the guard and the control flow merge instruction is no longer necessary.
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
718
2896
5d4aa5672d3d Small fix to design document.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2892
diff changeset
719 \begin{figure}[ht]
2682
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
720 \centering
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
721 \begin{digraphenv}{scale=0.5}{guard3}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
722 \textnode{entry}{Entry}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
723 \node{anchor1}{Anchor}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
724 \node{return}{Return}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
725 \node{cmpnull}{NonNull}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
726 \textnode{p}{p}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
727 \textnode{const0}{0}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
728 \nodeguard{guard2}{Guard}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
729 \nodetrisplit{store1}{MemStore 16 (int)}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
730 \nodetrisplit{store2}{MemStore 20 (int)}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
731 \nodeframestate{fs1}{FrameState}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
732 \nodeframestate{fs2}{FrameState}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
733 \data{store1:in1}{p}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
734 \data{store2:in1}{p}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
735 \data{store1:in2}{const0}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
736 \data{store2:in2}{const0}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
737 \data{store2:in3}{guard2}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
738 \data{guard2:in1}{anchor1}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
739 \data{guard2:in2}{cmpnull}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
740 \control{guard2}{store1}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
741 \control{entry}{anchor1}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
742 \control{anchor1}{store1}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
743 \controllabel{store1:succ2}{fs1}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
744 \control{store1}{store2}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
745 \controllabel{store2:succ1}{return}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
746 \controllabel{store2:succ2}{fs2}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
747 \data{cmpnull}{p}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
748 \end{digraphenv}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
749 \caption{After eliminating an if with a guard.}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
750 \label{fig:guard3}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
751 \end{figure}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
752
2679
07aa0a31fffb Rewrote frame state to be not-so-Java-specific. Clarified and reduced the usage of the term "node".
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2678
diff changeset
753 At some point during the compilation, guards need to be fixed, which means that appropriate data and control dependencies will be inserted so that they cannot move outside the scope of the associated frame state.
2576
c59db1f02893 doc: expanded framestate section
Lukas Stadler <lukas.stadler@jku.at>
parents: 2569
diff changeset
754 This will generate deoptimization-free zones that can be targeted by the most aggressive optimizations.
2682
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
755 A simple algorithm for this removal of frame states would be to move all guards as far upwards as possible and then the guards are fixed using anchor nodes.
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
756 In our example, the guard is already fixed, so there is no deoptimization point that uses any of the memory store frame states.
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
757 Therefore we can delete the frame states from the graph (see Figure \ref{fig:guard4}).
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
758
2896
5d4aa5672d3d Small fix to design document.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2892
diff changeset
759 \begin{figure}[ht]
2682
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
760 \centering
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
761 \begin{digraphenv}{scale=0.5}{guard4}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
762 \textnode{entry}{Entry}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
763 \node{anchor1}{Anchor}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
764 \node{return}{Return}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
765 \node{cmpnull}{NonNull}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
766 \textnode{p}{p}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
767 \textnode{const0}{0}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
768 \nodeguard{guard2}{Guard}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
769 \nodetrisplit{store1}{MemStore 16 (int)}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
770 \nodetrisplit{store2}{MemStore 20 (int)}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
771 \data{store1:in1}{p}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
772 \data{store2:in1}{p}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
773 \data{store1:in2}{const0}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
774 \data{store2:in2}{const0}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
775 \data{store2:in3}{guard2}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
776 \data{guard2:in1}{anchor1}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
777 \data{guard2:in2}{cmpnull}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
778 \control{guard2}{store1}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
779 \control{entry}{anchor1}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
780 \control{anchor1}{store1}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
781 \control{store1}{store2}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
782 \controllabel{store2:succ1}{return}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
783 \data{cmpnull}{p}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
784 \end{digraphenv}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
785 \caption{After removing the frame states.}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
786 \label{fig:guard4}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
787 \end{figure}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
788
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
789 Now we can use memory coalescing to combine the two stores without frame state to adjacent locations in the same object.
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
790 This is only possible if the first store does not have a frame state.
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
791 Figure \ref{fig:guard5} shows the resulting graph.
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
792
2577
ac2029d0898f doc: framestate and deopt changes
Lukas Stadler <lukas.stadler@jku.at>
parents: 2576
diff changeset
793
2896
5d4aa5672d3d Small fix to design document.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2892
diff changeset
794 \begin{figure}[ht]
2578
Lukas Stadler <lukas.stadler@jku.at>
parents: 2577 2574
diff changeset
795 \centering
2682
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
796 \begin{digraphenv}{scale=0.5}{guard5}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
797 \textnode{entry}{Entry}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
798 \node{anchor1}{Anchor}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
799 \node{return}{Return}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
800 \node{cmpnull}{NonNull}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
801 \textnode{p}{p}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
802 \textnode{const0}{0}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
803 \nodeguard{guard2}{Guard}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
804 \nodetrisplit{store1}{MemStore 16 (long)}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
805 \data{store1:in1}{p}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
806 \data{store1:in2}{const0}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
807 \data{guard2:in1}{anchor1}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
808 \data{guard2:in2}{cmpnull}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
809 \control{guard2}{store1}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
810 \control{entry}{anchor1}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
811 \control{anchor1}{store1}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
812 \controllabel{store1:succ1}{return}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
813 \data{cmpnull}{p}
2577
ac2029d0898f doc: framestate and deopt changes
Lukas Stadler <lukas.stadler@jku.at>
parents: 2576
diff changeset
814 \end{digraphenv}
2682
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
815 \caption{After coalescing the two memory stores.}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
816 \label{fig:guard5}
2578
Lukas Stadler <lukas.stadler@jku.at>
parents: 2577 2574
diff changeset
817 \end{figure}
2577
ac2029d0898f doc: framestate and deopt changes
Lukas Stadler <lukas.stadler@jku.at>
parents: 2576
diff changeset
818
2682
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
819 A memory store that immediately follows a null check guard instruction on the same object, can be combined into a store with an implicit null check (that deoptimizes instead of throwing the exception).
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
820 Therefore, we can remove the guard again and also the anchor is no longer necessary.
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
821 Figure~\ref{fig:guard6} shows now that fully optimized graph that is generated for Listing~\ref{lst:guard1}.
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
822
2896
5d4aa5672d3d Small fix to design document.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2892
diff changeset
823 \begin{figure}[ht]
2682
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
824 \centering
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
825 \begin{digraphenv}{scale=0.5}{guard6}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
826 \textnode{entry}{Entry}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
827 \node{return}{Return}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
828 \textnode{p}{p}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
829 \textnode{const0}{0}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
830 \nodetrisplit{store1}{DeoptimizingMemStore 16 (long)}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
831 \data{store1:in1}{p}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
832 \data{store1:in2}{const0}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
833 \control{entry}{store1}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
834 \controllabel{store1:succ1}{return}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
835 \end{digraphenv}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
836 \caption{Fully optimized method.}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
837 \label{fig:guard6}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
838 \end{figure}
c5739b99762a New field store / guard / frame state example.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2679
diff changeset
839
2561
765dd54244a6 Updated doc. Added Texclipse project.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2517
diff changeset
840
2597
08cda6637103 More doc + conclusion.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2591
diff changeset
841 \section{Conclusions}
2618
15774da89658 Incorporated comments from Peter. Renamings trap=>guard and guard/split=>anchor.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2604
diff changeset
842 \label{sec:conclusions}
2597
08cda6637103 More doc + conclusion.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2591
diff changeset
843 This document sketched the strategy for the Graph compiler.
08cda6637103 More doc + conclusion.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2591
diff changeset
844 We already reached M1 (as defined in Section~\ref{sec:mile}) and have the following plans for M2 to M4:
08cda6637103 More doc + conclusion.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2591
diff changeset
845 \begin{description}
08cda6637103 More doc + conclusion.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2591
diff changeset
846 \item[M2:] June 30th, 2011
08cda6637103 More doc + conclusion.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2591
diff changeset
847 \item[M3:] August 15th, 2011
08cda6637103 More doc + conclusion.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2591
diff changeset
848 \item[M4:] September 30th, 2011
08cda6637103 More doc + conclusion.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2591
diff changeset
849 \end{description}
2685
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2682
diff changeset
850 After we reach M4, we want to create a new project road map that further improves the Graal compiler with respect to its two main goals: Modularity and peak performance.
2561
765dd54244a6 Updated doc. Added Texclipse project.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2517
diff changeset
851
2517
8c6e31c62fba added initial version of design docs, fixed .hgignore (regex, . -> \.)
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
852 \end{document}