|
@@ -13994,7 +13994,7 @@ instruction. For example, the following puts the address of the
|
|
|
\end{lstlisting}
|
|
|
Recall from Section~\ref{sec:select-instructions-gc} that
|
|
|
\verb!inc(%rip)! is an example of instruction-pointer relative
|
|
|
-addressing. It computes the address of \code{inc}.
|
|
|
+addressing.
|
|
|
|
|
|
In Section~\ref{sec:x86} we used the \code{callq} instruction to jump
|
|
|
to functions whose locations were given by a label, such as
|
|
@@ -14023,14 +14023,14 @@ the target. However, \code{callq} does not handle
|
|
|
\item determining how registers are shared by different functions.
|
|
|
\end{enumerate}
|
|
|
|
|
|
-Regarding (1) parameter passing, recall that the x86-64 calling
|
|
|
+Regarding parameter passing, recall that the x86-64 calling
|
|
|
convention for Unix-based system uses the following six registers to
|
|
|
pass arguments to a function, in this order.
|
|
|
\begin{lstlisting}
|
|
|
rdi rsi rdx rcx r8 r9
|
|
|
\end{lstlisting}
|
|
|
If there are more than six arguments, then the calling convention
|
|
|
-mandates to use space on the frame of the caller for the rest of the
|
|
|
+mandates using space on the frame of the caller for the rest of the
|
|
|
arguments. However, to ease the implementation of efficient tail calls
|
|
|
(Section~\ref{sec:tail-call}), we arrange never to need more than six
|
|
|
arguments.
|
|
@@ -14039,8 +14039,8 @@ The return value of the function is stored in register \code{rax}.
|
|
|
|
|
|
\index{subject}{prelude}\index{subject}{conclusion}
|
|
|
|
|
|
-Regarding (2) frames \index{subject}{frame} and the procedure call
|
|
|
-stack, \index{subject}{procedure call stack} recall from
|
|
|
+Regarding frames \index{subject}{frame} and the procedure call stack,
|
|
|
+\index{subject}{procedure call stack} recall from
|
|
|
Section~\ref{sec:x86} that the stack grows down and each function call
|
|
|
uses a chunk of space on the stack called a frame. The caller sets the
|
|
|
stack pointer, register \code{rsp}, to the last data item in its
|
|
@@ -14058,9 +14058,9 @@ contain a valid pointer. Otherwise the garbage collector will
|
|
|
interpret the garbage bits in those slots as memory addresses and try
|
|
|
to traverse them, causing serious mayhem!
|
|
|
|
|
|
-Regarding (3) the sharing of registers between different functions,
|
|
|
-recall from Section~\ref{sec:calling-conventions} that the registers
|
|
|
-are divided into two groups, the caller-saved registers and the
|
|
|
+Regarding the sharing of registers between different functions, recall
|
|
|
+from Section~\ref{sec:calling-conventions} that the registers are
|
|
|
+divided into two groups, the caller-saved registers and the
|
|
|
callee-saved registers. The caller should assume that all the
|
|
|
caller-saved registers get overwritten with arbitrary values by the
|
|
|
callee. For that reason we recommend in
|