[comp.arch] Return addresses

jones@pyrite.cs.uiowa.edu (Douglas W. Jones,201H MLH,3193350740,3193382879) (03/12/91)

From article <1991Mar11.192116.1974@dgbt.doc.ca>, by don@dgbt.doc.ca (Donald McLachlan):
> 
> 	The idea of saving the return address in a register, rather than
> on the stack sounds nice to me, but ...

Pushing return addresses on the stack stands in the way of some semantic
constructs.  For example, coroutine semantics is easy to implement when
return addresses are stored in the caller's activation record (when stored
there, a return address is usually called a continuation point, since it is
used to continue execution in that activation record, not to return to some
other context).

If the hardware stores return addresses in the called routine's activation
record, extra code is needed to copy the return address to the caller's AR
whenever a coroutine transfer takes place.

Storing return addresses in a register (or in memory using non-stack based
indexing) allows the compiler writer far more flexibility in choosing the
semantics of the result.

(See Marlin's monograph entitled Coroutines in the Springer Lecture Notes
on Computer Science for everything you ever wanted to know about that
subject.)
				Doug Jones
				jones@cs.uiowa.edu