(j3.2006) COPY mode of argument association
Van Snyder
Van.Snyder
Thu Dec 17 18:40:18 EST 2015
On Thu, 2015-12-17 at 21:07 +0000, Lionel, Steve wrote:
> "The solution was to pass the location of the child vertex back as a
> function argument. I hope processors don't calculate the address of the
> function result and pass that as a hidden argument for the function to use
> to store its result value."
>
> Why, yes, they do. On the implementations I am familiar with, this happens
> if the result is of a type other than what the ABI says should be returned
> in registers. For example, returning any array or CHARACTER value would be
> done with a hidden argument containing an address of temporary storage
> computed by the caller.
>
> I didn't fully understand the problem statement, but it seemed to me that
> pointers might be an appropriate solution.
Here's the recursive function reference:
QTM_Trees%Q(root)%son(f) = Add_QTM_Vertex_To_Tree ( 4*QID+f )
Add_QTM_Vertex_To_Tree is an internal function. It can access QTM_Trees
by host association. If QTM_Trees%Q runs out of space, it's reallocated
twice as big, the old one copied into the new, and then deleted. So the
QTM_Trees%Q(root) in effect when Add_QTM_Vertex_To_Tree is invoked might
be a different one when it returns.
I understand that if the result type of Add_QTM_Vertex_To_Tree isn't one
that can be returned in a register that the processor will compute an
address and tell Add_QTM_Vertex_To_Tree where to store its result. I
just hope it's not the address of QTM_Trees%Q(root)%son(f).
The reference used to be
call Add_QTM_Vertex_To_Tree ( QTM_Trees%Q(root)%son(f), 4*QID+f )
That didn't work because if Add_QTM_Vertex_To_Tree reallocated QTM_Trees
%Q it violated the "no change to the actual argument except through the
dummy argument" dictum.
> Steve
>
More information about the J3
mailing list