|
@@ -13153,10 +13153,12 @@ an array:
|
|
|
that none of the elements are pointers to the heap and a $1$
|
|
|
indicates that all of the elements are pointers.
|
|
|
|
|
|
-\item The next $61$ bits store the length of the array.
|
|
|
+\item The next $60$ bits store the length of the array.
|
|
|
|
|
|
-\item The left-most bit distinguishes between a tuple ($0$) versus an
|
|
|
- array ($1$).
|
|
|
+\item The bit at position $62$ distinguishes between a tuple ($0$)
|
|
|
+ versus an array ($1$).
|
|
|
+
|
|
|
+\item The left-most bit is reserved for use in Chapter~\ref{ch:Lgrad}.
|
|
|
\end{itemize}
|
|
|
|
|
|
|
|
@@ -13182,8 +13184,8 @@ when the argument's type is \CARRAYTY{T}.
|
|
|
|
|
|
We recommend inserting a new pass named \code{check\_bounds} that
|
|
|
inserts code around each \racket{\code{vector-ref} and \code{vector-set!}}
|
|
|
-\python{subscript} operation to ensure that the index is greater than or equal to zero
|
|
|
-and less than the array's length.
|
|
|
+\python{subscript} operation to ensure that the index is greater than or
|
|
|
+equal to zero and less than the array's length.
|
|
|
|
|
|
%% \subsection{Reveal Casts}
|
|
|
|
|
@@ -19845,7 +19847,7 @@ and a target type, and translates it to expression in \LangProxy{} that has
|
|
|
the same behavior as casting the expression from the source to the
|
|
|
target type in the interpreter.
|
|
|
|
|
|
-The \code{lower-cast} function can follow a code structure similar to
|
|
|
+The \code{lower\_cast} function can follow a code structure similar to
|
|
|
the \code{apply\_cast} function (Figure~\ref{fig:apply_cast}) used in
|
|
|
the interpreter for \LangCast{} because it must handle the same cases as
|
|
|
\code{apply\_cast} and it needs to mimic the behavior of
|
|
@@ -19855,15 +19857,17 @@ casts between two tuple types and between two function types.
|
|
|
As mentioned in Section~\ref{sec:interp-casts}, a cast from one tuple
|
|
|
type to another tuple type is accomplished by creating a proxy that
|
|
|
intercepts the operations on the underlying tuple. Here we make the
|
|
|
-creation of the proxy explicit with the \code{vector-proxy} primitive
|
|
|
-operation. It takes three arguments, the first is an expression for
|
|
|
+creation of the proxy explicit with the
|
|
|
+\racket{\code{vector-proxy}}\python{\code{tuple\_proxy}}
|
|
|
+primitive operation. It takes three arguments, the first is an expression for
|
|
|
the tuple, the second is a tuple of functions for casting an element
|
|
|
that is being read from the tuple, and the third is a tuple of
|
|
|
functions for casting an element that is being written to the tuple.
|
|
|
You can create the functions using \code{Lambda}. Also, as we shall
|
|
|
see in the next section, we need to differentiate these tuples from
|
|
|
-the user-created ones, so we recommend using a new primitive operator
|
|
|
-named \code{raw-vector} instead of \code{vector} to create these
|
|
|
+the user-created ones, so we recommend using a new primitive function
|
|
|
+named \racket{\code{raw-vector}}\python{\code{raw\_tuple}} instead of
|
|
|
+\racket{\code{vector}}\python{\code{Tuple}} to create these
|
|
|
tuples of functions. Figure~\ref{fig:map-bang-lower-cast} shows
|
|
|
the output of \code{lower\_casts} on the example in
|
|
|
Figure~\ref{fig:map-bang} that involved casting a tuple of
|