next up previous contents index
Next: Methods that return multiarrays Up: Basic translation Previous: Translating field accesses   Contents   Index


Translating method invocations

There are two cases to consider. The case where the result of the method is not a multiarray, and the case where the result is a multiarray. First we consider the case where the result is not a multiarray. The general scheme is illustrated in Figure A.31. This scheme is modified in trivial ways if the method is static, or is applied to the current object.

The macro TRANS_ARGS evaluates to a list of translated expressions. We will define it in terms of the simpler macro TRANS_ARG which operates on a single argument. If the invoked method (or, in later sections, constructor) is not an HPspmd method (or constructor) the definition is:

\begin{displaymath}
\begin{minipage}[t]{\linewidth}\begin{tabbing}
$\mbox{\it TR...
...\it TRANS\_ARG}\left(e_{N-1}\right)$\end{tabbing}\end{minipage}\end{displaymath}

If the invoked method (or constructor) is an HPspmd method (or constructor), the definition is:

\begin{displaymath}
\begin{minipage}[t]{\linewidth}\begin{tabbing}
$\mbox{\it TR...
...N-1}\right)$\verb$, $\mbox{\it apg}
\end{tabbing}\end{minipage}\end{displaymath}

Now, if $e$ is not a multiarray, then

\begin{displaymath}
\begin{minipage}[t]{\linewidth}\begin{tabbing}
$\mbox{\it TR...
...equiv \quad {\bf T}\left[{e}\right]$\end{tabbing}\end{minipage}\end{displaymath}

Otherwise, if $e$ is a multiarray expression of rank $R$, then

\begin{displaymath}
\begin{minipage}[t]{\linewidth}\begin{tabbing}
$\mbox{\it TR...
...{\mbox{\small dat}}\left[{e}\right]$\end{tabbing}\end{minipage}\end{displaymath}

In other words, each multiarray argument is split into $2 + R$ arguments.

Figure A.32: Translation of multiarray-valued method invocation expression.
SOURCE:

\begin{displaymath}
\begin{minipage}[t]{\linewidth}\begin{tabbing}
$v$ \verb$ =...
...\ldots$\verb$, $$e_{N-1}$\verb$) ;$
\end{tabbing}\end{minipage}\end{displaymath}

TRANSLATION:


\begin{displaymath}
\begin{minipage}[t]{\linewidth}\begin{tabbing}
\verb$DAD $$d...
...$ = $$\mbox{\it TRANS\_DIM}(d, R-1)$\end{tabbing}\end{minipage}\end{displaymath}

where:

\begin{displaymath}
\begin{array}{l}
\mbox{The expression $v$ is the assigned a...
...M}} \\
\quad \quad \mbox{are defined in the text.}
\end{array}\end{displaymath}



Subsections
next up previous contents index
Next: Methods that return multiarrays Up: Basic translation Previous: Translating field accesses   Contents   Index
Bryan Carpenter 2003-04-15