Jeremy Siek пре 2 година
родитељ
комит
7c62c9cb9c
1 измењених фајлова са 77 додато и 76 уклоњено
  1. 77 76
      book.tex

+ 77 - 76
book.tex

@@ -26,7 +26,7 @@
 
 \def\racketEd{0}
 \def\pythonEd{1}
-\def\edition{0}
+\def\edition{1}
 
 % material that is specific to the Racket edition of the book
 \newcommand{\racket}[1]{{\if\edition\racketEd{#1}\fi}}
@@ -2888,19 +2888,19 @@ that uses a reserved register to fix outstanding problems.
 \fi}
 
 {\if\edition\pythonEd
-\begin{tikzpicture}[baseline=(current  bounding  box.center),scale=0.90]
+\begin{tikzpicture}[baseline=(current  bounding  box.center),scale=0.85]
 \node (Lvar) at (0,2)  {\large \LangVar{}};
-\node (Lvar-2) at (3,2)  {\large \LangVarANF{}};
-\node (x86-1) at (3,0)  {\large \LangXVar{}};
-\node (x86-2) at (6,0)  {\large \LangXVar{}};
-\node (x86-3) at (9,0) {\large \LangXInt{}};
+\node (Lvar-2) at (4,2)  {\large \LangVarANF{}};
+\node (x86-1) at (0,0)  {\large \LangXVar{}};
+\node (x86-2) at (4,0)  {\large \LangXVar{}};
+\node (x86-3) at (8,0) {\large \LangXInt{}};
 \node (x86-4) at (12,0) {\large \LangXInt{}};
 
-\path[->,bend left=15] (Lvar) edge [above] node {\ttfamily\footnotesize remove\_complex.} (Lvar-2);
-\path[->,bend right=15] (Lvar-2) edge [left] node {\ttfamily\footnotesize select\_instr.} (x86-1);
+\path[->,bend left=15] (Lvar) edge [above] node {\ttfamily\footnotesize remove\_complex\_operands} (Lvar-2);
+\path[->,bend left=15] (Lvar-2) edge [left] node {\ttfamily\footnotesize select\_instructions} (x86-1);
 \path[->,bend right=15] (x86-1) edge [below] node {\ttfamily\footnotesize assign\_homes} (x86-2);
-\path[->,bend left=15] (x86-2) edge [above] node {\ttfamily\footnotesize patch\_instr.} (x86-3);
-\path[->,bend right=15] (x86-3) edge [below] node {\ttfamily\footnotesize prelude\_and\_concl.} (x86-4);
+\path[->,bend left=15] (x86-2) edge [above] node {\ttfamily\footnotesize patch\_instructions} (x86-3);
+\path[->,bend right=15] (x86-3) edge [below] node {\ttfamily\footnotesize prelude\_and\_conclusion} (x86-4);
 \end{tikzpicture}
 \fi}  
 \end{tcolorbox}
@@ -7289,7 +7289,7 @@ class TypeCheckLvar:
 \end{lstlisting}
 \fi}
 {\if\edition\pythonEd
-\begin{lstlisting}
+\begin{lstlisting}[basicstyle=\ttfamily\footnotesize]
 class TypeCheckLif(TypeCheckLvar):
   def type_check_exp(self, e, env):
     match e:
@@ -9248,22 +9248,22 @@ conclusion:
 {\if\edition\pythonEd
 \begin{tikzpicture}[baseline=(current  bounding  box.center),scale=0.90]
 \node (Lif-1) at (0,2)  {\large \LangIf{}};
-\node (Lif-2) at (3,2)  {\large \LangIf{}};
-\node (Lif-3) at (6,2)  {\large \LangIfANF{}};
-\node (C-1) at (3,0)  {\large \LangCIf{}};
+\node (Lif-2) at (4,2)  {\large \LangIf{}};
+\node (Lif-3) at (8,2)  {\large \LangIfANF{}};
+\node (C-1) at (0,0)  {\large \LangCIf{}};
 
-\node (x86-1) at (3,-2)  {\large \LangXIfVar{}};
-\node (x86-2) at (6,-2)  {\large \LangXIfVar{}};
-\node (x86-3) at (9,-2)  {\large \LangXIf{}};
+\node (x86-1) at (0,-2)  {\large \LangXIfVar{}};
+\node (x86-2) at (4,-2)  {\large \LangXIfVar{}};
+\node (x86-3) at (8,-2)  {\large \LangXIf{}};
 \node (x86-4) at (12,-2) {\large \LangXIf{}};
 
 \path[->,bend left=15] (Lif-1) edge [above] node {\ttfamily\footnotesize shrink} (Lif-2);
-\path[->,bend left=15] (Lif-2) edge [above] node {\ttfamily\footnotesize remove\_complex.} (Lif-3);
+\path[->,bend left=15] (Lif-2) edge [above] node {\ttfamily\footnotesize remove\_complex\_operands} (Lif-3);
 \path[->,bend left=15] (Lif-3) edge [right] node {\ttfamily\footnotesize explicate\_control} (C-1);
-\path[->,bend right=15] (C-1) edge [left] node {\ttfamily\footnotesize select\_instr.} (x86-1);
+\path[->,bend right=15] (C-1) edge [right] node {\ttfamily\footnotesize select\_instructions} (x86-1);
 \path[->,bend right=15] (x86-1) edge [below] node {\ttfamily\footnotesize assign\_homes} (x86-2);
-\path[->,bend left=15] (x86-2) edge [above] node {\ttfamily\footnotesize patch\_instr.} (x86-3);
-\path[->,bend right=15] (x86-3) edge [below] node {\ttfamily\footnotesize prelude\_and\_concl. } (x86-4);
+\path[->,bend left=15] (x86-2) edge [above] node {\ttfamily\footnotesize patch\_instructions} (x86-3);
+\path[->,bend right=15] (x86-3) edge [below] node {\ttfamily\footnotesize prelude\_and\_conclusion} (x86-4);
 \end{tikzpicture}
 \fi}
 \end{tcolorbox}
@@ -10913,14 +10913,10 @@ The \code{analyze\_dataflow} function has the following four parameters.
 
 \begin{figure}[p]
 \begin{tcolorbox}[colback=white]      
+{\if\edition\racketEd
 \begin{tikzpicture}[baseline=(current  bounding  box.center),scale=0.90]
 \node (Lfun) at (0,2)  {\large \LangLoop{}};
 \node (Lfun-2) at (3,2)  {\large \LangLoop{}};
-%\node (Lfun-3) at (6,2)  {\large \LangLoop{}};
-%\node (Lfun-4) at (9,2)  {\large \LangLoopFunRef{}};
-%\node (F1-1) at (12,0)  {\large \LangLoopFunRef{}};
-%\node (F1-2) at (9,0)  {\large \LangLoopFunRef{}};
-%\node (F1-3) at (6,0)  {\large \LangLoopFunRef{}};
 \node (F1-4) at (6,2)  {\large \LangLoop{}};
 \node (F1-5) at (9,2)  {\large \LangLoop{}};
 \node (F1-6) at (9,0)  {\large \LangLoopANF{}};
@@ -10933,23 +10929,10 @@ The \code{analyze\_dataflow} function has the following four parameters.
 \node (x86-4) at (8,-2) {\large \LangXIf{}};
 \node (x86-5) at (8,-4) {\large \LangXIf{}};
 
-
-%% \path[->,bend left=15] (Lfun) edge [above] node
-%%      {\ttfamily\footnotesize type-check} (Lfun-2);
 \path[->,bend left=15] (Lfun) edge [above] node
      {\ttfamily\footnotesize shrink} (Lfun-2);
 \path[->,bend left=15] (Lfun-2) edge [above] node
      {\ttfamily\footnotesize uniquify} (F1-4);
-%% \path[->,bend left=15] (Lfun-3) edge [above] node
-%%      {\ttfamily\footnotesize reveal\_functions} (Lfun-4);
-%% \path[->,bend left=15] (Lfun-4) edge [right] node
-%%      {\ttfamily\footnotesize convert\_assignments} (F1-1);
-%% \path[->,bend left=15] (Lfun-4) edge [right] node
-%%      {\ttfamily\footnotesize convert\_to\_clos.} (F1-2);
-%% \path[->,bend right=15] (F1-2) edge [above] node
-%%      {\ttfamily\footnotesize limit\_fun.} (F1-3);
-%% \path[->,bend right=15] (F1-3) edge [above] node
-%%      {\ttfamily\footnotesize expose-alloc.} (F1-4);
 \path[->,bend left=15] (F1-4) edge [above] node
      {\ttfamily\footnotesize uncover\_get!} (F1-5);
 \path[->,bend left=15] (F1-5) edge [left] node
@@ -10969,6 +10952,35 @@ The \code{analyze\_dataflow} function has the following four parameters.
 \path[->,bend left=15] (x86-4) edge [right] node
      {\ttfamily\footnotesize prelude\_and\_conclusion} (x86-5);
 \end{tikzpicture}
+\fi}
+{\if\edition\pythonEd
+\begin{tikzpicture}[baseline=(current  bounding  box.center),scale=0.90]
+\node (Lfun) at (0,2)  {\large \LangLoop{}};
+\node (Lfun-2) at (4,2)  {\large \LangLoop{}};
+\node (F1-6) at (8,2)  {\large \LangLoopANF{}};
+\node (C3-2) at (0,0)  {\large \racket{\LangCLoop{}}\python{\LangCIf{}}};
+
+\node (x86-2) at (0,-2)  {\large \LangXIfVar{}};
+\node (x86-3) at (4,-2)  {\large \LangXIfVar{}};
+\node (x86-4) at (8,-2) {\large \LangXIf{}};
+\node (x86-5) at (12,-2) {\large \LangXIf{}};
+
+\path[->,bend left=15] (Lfun) edge [above] node
+     {\ttfamily\footnotesize shrink} (Lfun-2);
+\path[->,bend left=15] (Lfun-2) edge [above] node
+     {\ttfamily\footnotesize remove\_complex\_operands} (F1-6);
+\path[->,bend left=10] (F1-6) edge [right] node
+     {\ttfamily\footnotesize explicate\_control} (C3-2);
+\path[->,bend right=15] (C3-2) edge [right] node
+     {\ttfamily\footnotesize select\_instructions} (x86-2);
+\path[->,bend right=15] (x86-2) edge [below] node
+     {\ttfamily\footnotesize assign\_homes} (x86-3);
+\path[->,bend left=15] (x86-3) edge [above] node
+     {\ttfamily\footnotesize patch\_instructions} (x86-4);
+\path[->,bend right=15] (x86-4) edge [below] node
+     {\ttfamily\footnotesize prelude\_and\_conclusion} (x86-5);
+\end{tikzpicture}
+\fi}
 \end{tcolorbox}
 
 \caption{Diagram of the passes for \LangLoop{}.}
@@ -12653,30 +12665,26 @@ conclusion:
 \end{tikzpicture}
 \fi}
 {\if\edition\pythonEd
-\begin{tikzpicture}[baseline=(current  bounding  box.center),scale=0.90]
+\begin{tikzpicture}[baseline=(current  bounding  box.center),scale=0.85]
 \node (Lvec) at (0,2)  {\large \LangVec{}};
-\node (Lvec-2) at (3,2)  {\large \LangVec{}};
-\node (Lvec-5) at (6,2)  {\large \LangAlloc{}};
-\node (Lvec-6) at (9,2)  {\large \LangAllocANF{}};
-\node (C2-4) at (3,0)  {\large \LangCVec{}};
+\node (Lvec-2) at (4,2)  {\large \LangVec{}};
+\node (Lvec-5) at (8,2)  {\large \LangAlloc{}};
+\node (Lvec-6) at (12,2)  {\large \LangAllocANF{}};
+\node (C2-4) at (0,0)  {\large \LangCVec{}};
 
-\node (x86-2) at (3,-2)  {\large \LangXGlobalVar{}};
-\node (x86-2-1) at (3,-4)  {\large \LangXGlobalVar{}};
-\node (x86-2-2) at (6,-4)  {\large \LangXGlobalVar{}};
-\node (x86-3) at (6,-2)  {\large \LangXGlobalVar{}};
-\node (x86-4) at (9,-2) {\large \LangXGlobal{}};
-\node (x86-5) at (9,-4) {\large \LangXGlobal{}};
+\node (x86-2) at (0,-2)  {\large \LangXGlobalVar{}};
+\node (x86-3) at (4,-2)  {\large \LangXGlobalVar{}};
+\node (x86-4) at (8,-2) {\large \LangXGlobal{}};
+\node (x86-5) at (12,-2) {\large \LangXGlobal{}};
 
 \path[->,bend left=15] (Lvec) edge [above] node {\ttfamily\footnotesize shrink} (Lvec-2);
 \path[->,bend left=15] (Lvec-2) edge [above] node {\ttfamily\footnotesize expose\_allocation} (Lvec-5);
 \path[->,bend left=15] (Lvec-5) edge [above] node {\ttfamily\footnotesize remove\_complex\_operands} (Lvec-6);
 \path[->,bend left=10] (Lvec-6) edge [right] node {\ttfamily\footnotesize explicate\_control} (C2-4);
 \path[->,bend left=15] (C2-4) edge [right] node {\ttfamily\footnotesize select\_instructions} (x86-2);
-\path[->,bend right=15] (x86-2) edge [left] node {\ttfamily\footnotesize uncover\_live} (x86-2-1);
-\path[->,bend right=15] (x86-2-1) edge [below] node {\ttfamily\footnotesize build\_interference} (x86-2-2);
-\path[->,bend right=15] (x86-2-2) edge [right] node {\ttfamily\footnotesize allocate\_registers} (x86-3);
+\path[->,bend right=15] (x86-2) edge [below] node {\ttfamily\footnotesize assign\_homes} (x86-3);
 \path[->,bend left=15] (x86-3) edge [above] node {\ttfamily\footnotesize patch\_instructions} (x86-4);
-\path[->,bend left=15] (x86-4) edge [right] node {\ttfamily\footnotesize prelude\_and\_conclusion} (x86-5);
+\path[->,bend right=15] (x86-4) edge [below] node {\ttfamily\footnotesize prelude\_and\_conclusion} (x86-5);
 \end{tikzpicture}
 \fi}
   \end{tcolorbox}
@@ -15075,22 +15083,19 @@ previously created test programs.
 \end{tikzpicture}
 \fi}
 {\if\edition\pythonEd
-    \begin{tikzpicture}[baseline=(current  bounding  box.center)]
+\begin{tikzpicture}[baseline=(current  bounding  box.center),scale=0.85]
 \node (Lfun) at (0,2)  {\large \LangFun{}};
-\node (Lfun-2) at (3,2)  {\large \LangFun{}};
-\node (F1-1) at (6,2)  {\large \LangFunRef{}};
-\node (F1-2) at (9,2)  {\large \LangFunRef{}};
-\node (F1-4) at (3,0)  {\large \LangFunRefAlloc{}};
+\node (Lfun-2) at (4,2)  {\large \LangFun{}};
+\node (F1-1) at (8,2)  {\large \LangFunRef{}};
+\node (F1-2) at (12,2)  {\large \LangFunRef{}};
+\node (F1-4) at (4,0)  {\large \LangFunRefAlloc{}};
 \node (F1-5) at (0,0)  {\large \LangFunANF{}};
 \node (C3-2) at (0,-2)  {\large \LangCFun{}};
 
 \node (x86-2) at (0,-4)  {\large \LangXIndCallVar{}};
-\node (x86-3) at (3,-4)  {\large \LangXIndCallVar{}};
-\node (x86-4) at (6,-4) {\large \LangXIndCall{}};
-\node (x86-5) at (6,-6) {\large \LangXIndCallFlat{}};
-
-\node (x86-2-1) at (0,-6)  {\large \LangXIndCallVar{}};
-\node (x86-2-2) at (3,-6)  {\large \LangXIndCallVar{}};
+\node (x86-3) at (4,-4)  {\large \LangXIndCallVar{}};
+\node (x86-4) at (8,-4) {\large \LangXIndCall{}};
+\node (x86-5) at (12,-4) {\large \LangXIndCallFlat{}};
 
 \path[->,bend left=15] (Lfun) edge [above] node
      {\ttfamily\footnotesize shrink} (Lfun-2);
@@ -15099,22 +15104,18 @@ previously created test programs.
 \path[->,bend left=15] (F1-1) edge [above] node
      {\ttfamily\footnotesize limit\_functions} (F1-2);
 \path[->,bend left=15] (F1-2) edge [right] node
-     {\ttfamily\footnotesize expose\_alloc.} (F1-4);
+     {\ttfamily\footnotesize expose\_allocation} (F1-4);
 \path[->,bend right=15] (F1-4) edge [above] node
-     {\ttfamily\footnotesize remove\_complex.} (F1-5);
+     {\ttfamily\footnotesize remove\_complex\_operands} (F1-5);
 \path[->,bend right=15] (F1-5) edge [right] node
      {\ttfamily\footnotesize explicate\_control} (C3-2);
 \path[->,bend left=15] (C3-2) edge [right] node
-     {\ttfamily\footnotesize select\_instr.} (x86-2);
-\path[->,bend right=15] (x86-2) edge [right] node
-     {\ttfamily\footnotesize uncover\_live} (x86-2-1);
-\path[->,bend right=15] (x86-2-1) edge [below] node 
-     {\ttfamily\footnotesize build\_inter.} (x86-2-2);
-\path[->,bend right=15] (x86-2-2) edge [right] node
-     {\ttfamily\footnotesize allocate\_reg.} (x86-3);
+     {\ttfamily\footnotesize select\_instructions} (x86-2);
+\path[->,bend right=15] (x86-2) edge [below] node
+     {\ttfamily\footnotesize assign\_homes} (x86-3);
 \path[->,bend left=15] (x86-3) edge [above] node
-     {\ttfamily\footnotesize patch\_instr.} (x86-4);
-\path[->,bend left=15] (x86-4) edge [right] node {\ttfamily\footnotesize prelude.} (x86-5);
+     {\ttfamily\footnotesize patch\_instructions} (x86-4);
+\path[->,bend right=15] (x86-4) edge [below] node {\ttfamily\footnotesize prelude\_and\_conclusion} (x86-5);
 \end{tikzpicture}
 \fi}
   \end{tcolorbox}