From mboxrd@z Thu Jan 1 00:00:00 1970 From: grog@lemis.com (Greg 'groggy' Lehey) Date: Wed, 6 Jan 2016 10:04:40 +1100 Subject: [TUHS] PDP-11 MARK (was: Early Unix function calls: expensive?) In-Reply-To: <568C2923.3040204@update.uu.se> References: <568C2923.3040204@update.uu.se> Message-ID: <20160105230440.GA85978@eureka.lemis.com> On Tuesday, 5 January 2016 at 21:35:47 +0100, Johnny Billquist wrote: > On 2016-01-05 18:43, Ronald Natalie wrote: >> >> Just never figured out how to make good use of the MARK instruction on the PDP-11. > > Not surprising. As others noted, few ever did. And apparently none > responding actually do either. > > It *is* a stupid instruction in many ways. And it's not for multiple > returns either. > > It's an odd way of handling stack cleanup without a frame pointer. Thanks for the (omitted) explanation. At first sight, the instruction almost seems to make sense for functions with a variable number of parameters, but of course there are simpler ways to do it. I wonder if this is a case of "it sounded like a good idea at the time" (when the instruction set was being designed), and it took a while for people to realize that it wasn't of any use. I recall a similar issue with the Siemens 306, their first stack-based machine, round about 1975. They had function call and return instructions which manipulated the stack pointer, but it seemed that nobody used them: they didn't work. From memory, the call instruction incremented the stack pointer and stored PC. The return call instruction decemented the stack pointer and loaded PC--from the wrong location. I never used the 306 myself, but I often wondered if they modified one of the instructions to DTRT. Greg -- Sent from my desktop computer. Finger grog at FreeBSD.org for PGP public key. See complete headers for address and phone numbers. This message is digitally signed. If your Microsoft MUA reports problems, please read http://tinyurl.com/broken-mua -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 181 bytes Desc: not available URL: