|
@@ -11839,24 +11839,30 @@ block40:
|
|
|
|
|
|
As discussed earlier in this chapter, the garbage collector needs to
|
|
As discussed earlier in this chapter, the garbage collector needs to
|
|
access all the pointers in the root set, that is, all variables that
|
|
access all the pointers in the root set, that is, all variables that
|
|
-are vectors. It will be the responsibility of the register allocator
|
|
|
|
|
|
+are tuple. It will be the responsibility of the register allocator
|
|
to make sure that:
|
|
to make sure that:
|
|
\begin{enumerate}
|
|
\begin{enumerate}
|
|
-\item the root stack is used for spilling vector-typed variables, and
|
|
|
|
-\item if a vector-typed variable is live during a call to the
|
|
|
|
|
|
+\item the root stack is used for spilling tuple-typed variables, and
|
|
|
|
+\item if a tuple-typed variable is live during a call to the
|
|
collector, it must be spilled to ensure it is visible to the
|
|
collector, it must be spilled to ensure it is visible to the
|
|
collector.
|
|
collector.
|
|
\end{enumerate}
|
|
\end{enumerate}
|
|
|
|
|
|
The later responsibility can be handled during construction of the
|
|
The later responsibility can be handled during construction of the
|
|
interference graph, by adding interference edges between the call-live
|
|
interference graph, by adding interference edges between the call-live
|
|
-vector-typed variables and all the callee-saved registers. (They
|
|
|
|
-already interfere with the caller-saved registers.) The type
|
|
|
|
-information for variables is in the \code{Program} form, so we
|
|
|
|
-recommend adding another parameter to the \code{build\_interference}
|
|
|
|
-function to communicate this alist.
|
|
|
|
|
|
+tuple-typed variables and all the callee-saved registers. (They
|
|
|
|
+already interfere with the caller-saved registers.)
|
|
|
|
+%
|
|
|
|
+\racket{The type information for variables is in the \code{Program}
|
|
|
|
+ form, so we recommend adding another parameter to the
|
|
|
|
+ \code{build\_interference} function to communicate this alist.}
|
|
|
|
+%
|
|
|
|
+\python{The type information for variables is generated by the type
|
|
|
|
+ checker for \LangCVec{}, stored a field named \code{var\_types} in
|
|
|
|
+ the \code{CProgram} AST mode. You'll need to propagate that
|
|
|
|
+ information so that it is available in this pass.}
|
|
|
|
|
|
-The spilling of vector-typed variables to the root stack can be
|
|
|
|
|
|
+The spilling of tuple-typed variables to the root stack can be
|
|
handled after graph coloring, when choosing how to assign the colors
|
|
handled after graph coloring, when choosing how to assign the colors
|
|
(integers) to registers and stack locations. The \code{Program} output
|
|
(integers) to registers and stack locations. The \code{Program} output
|
|
of this pass changes to also record the number of spills to the root
|
|
of this pass changes to also record the number of spills to the root
|