From mboxrd@z Thu Jan 1 00:00:00 1970 From: cowan@mercury.ccil.org (John Cowan) Date: Tue, 5 Jan 2016 11:46:43 -0500 Subject: [TUHS] Early Unix function calls: expensive? In-Reply-To: References: <20160103233543.GA10102@minnie.tuhs.org> <76BC99D5-A8C4-4F8B-8D7D-C621CBD18238@tfeb.org> <20160104000113.GD1602@mercury.ccil.org> <328D91D8-FF74-46EE-A281-5432716E6206@ieee.org> <418F9945-C1BC-4EA1-85F3-981342A9BDD6@ronnatalie.com> Message-ID: <20160105164642.GA20786@mercury.ccil.org> Clem Cole scripsit: > On Mon, Jan 4, 2016 at 9:00 PM, Ronald Natalie 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