The scheme for translating a multiarray-valued method declaration is illustrated in Figure A.15.
The macro TRANS_ID encodes the dimension signature of the returned array and is defined in section A.4.2. The macro TRANS_PARAMS was defined earlier in this section.
Instances of the class DAD (the initials stand for Distributed Array Descriptor) contain a reference to an ArrayBase object, and a vector of instances of ArrayDim. These values are stored in fields base and dimensions, respectively. The DAD object will be created in the calling program and passed to the translated method. Before the method returns, it will store the parameters describing the layout of the multiarray result in these fields (see sections A.4.15 and A.4.15).
An alternative--in some ways more obvious--translation would place the element array in a field in the DAD, and have the method return a DAD. However this would require either we create a separate DAD class for every possible element type--which is hard because HPJava supports multiarrays with arbitrary Java types, including user-defined class and interface types, or the element array field in our extended DAD has the universal Object type. In the latter case one would cast the object back to the appropriate element-array type on return from the call. There is a fatal problem with this approach however: it does not encode the element type of the multiarray in the class file generated by compiling the translated code. So the return type of the method cannot be determined by HPJava programs that load the declaring class from a class file.