[TUHS] Early Unix function calls: expensive?

John Cowan cowan at mercury.ccil.org
Wed Jan 6 02:46:43 AEST 2016

Clem Cole scripsit:

> On Mon, Jan 4, 2016 at 9:00 PM, Ronald Natalie <ron at ronnatalie.com> wrote:
> > Just never figured out how to make good use of the MARK instruction on the
> > PDP-11.
> If I understand it correctly, few if anyone did.

My guess would be that it was intended to support the antiquated Fortran
feature of "multiple returns", whereby a caller could pass one or more
labels (defined in the caller) to the callee, which could then choose to
return directly to one of them rather than through the return address.
In gcc this is implemented by wrapping the call in a switch which
does a (local) goto based on the integer returned by the callee.
(Only subroutines, i.e. subprograms that do not return a user-visible
value, supported multiple returns.)

A PDP-11 Fortran compiler could have followed such a subroutine call by
a series of branch instructions and had the callee use MARK rather than
RTS to return to the correct point in the jump table.

This doesn't explain why some sources of instruction-set information
say that MARK "facilitates stack clean-up procedures", though.

John Cowan          http://www.ccil.org/~cowan        cowan at ccil.org
How they ever reached any conclusion at all is starkly unknowable
to the human mind.        --"Backstage Lensman", Randall Garrett

More information about the TUHS mailing list