next up previous contents index
Next: A recommendation for updating Up: Rules for access to Previous: Changes for ghost regions   Contents   Index

A final rule for array element access

The rules on subscripts given in the last two subsections go a long way towards ensuring a crucial requirement of HPJava, namely that a process may only access locally held array elements. There are still odd cases--typically involving array sections--where those rules are insufficient. Consider the pathological example of Figure 5.1. The subscripts on the element reference b [j] are legal--j is certainly a location in b.rng(0) (which is equal to y). But, as illustrated, the section b is localized to $\mbox{\tt p} / \mbox{\tt x[0]}$--the top row of processes in the figure--whereas the at construct specifies that the element assignments are performed in the group $\mbox{\tt p} / \mbox{\tt x[N-1]}$--the bottom row of processes.

Figure 5.1: Access error discussed in text. Section b is shaded area at top. The at construct restricts control to the bottom row of processes.

\begin{displaymath}
\begin{minipage}[t]{\linewidth}\small\begin{verbatim}Proc...
... y for :)
b [j] = j\lq  ; // ERROR
}\end{verbatim}\end{minipage}\end{displaymath}

\includegraphics{accessError.eps}

This kind of error can be excluded by the following rule:

Rule 8   An element reference in an array $a$ can only be made by a process that is contained in the distribution group $a \mbox{\tt .grp()}$.

If this rule is not satisfied a java.lang.NullPointerException will be thrown.

The error above is now exposed, because the distribution group of b is $\mbox{\tt p} / \mbox{\tt x[0]}$. This does not contain the active process group inside the overall construct, namely $\mbox{\tt p} / \mbox{\tt x[N-1]} / \mbox{\tt j}$. So the processes executing the array access fail to meet the criterion of rule 8.


next up previous contents index
Next: A recommendation for updating Up: Rules for access to Previous: Changes for ghost regions   Contents   Index
Bryan Carpenter 2003-04-15