Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!caip!seismo!umcp-cs!cvl!umd5!zben From: zben@umd5.UUCP (Ben Cranston) Newsgroups: net.lang.c Subject: Re: Swap by name Message-ID: <1060@umd5.UUCP> Date: Sun, 6-Jul-86 18:49:08 EDT Article-I.D.: umd5.1060 Posted: Sun Jul 6 18:49:08 1986 Date-Received: Mon, 7-Jul-86 02:20:43 EDT References: <1964@brl-smoke.ARPA> Reply-To: zben@umd5.UUCP (Ben Cranston) Organization: U of Md, CSC, College Park, Md Lines: 42 Summary: Plus compiler lineage; call by name != call by value/return In article <1964@brl-smoke.ARPA> rbj@icst-cmr.ARPA (Root Boy Jim) writes: ... > I was thinking of the caller squirrelling away the value in a temporary > location, passing it by reference (thus allowing modification by the > callee) and then copying the result to the real variable. Of course the difference between this and real call-by-name comes when the subroutine has an alternate access to the global in question - perhaps because of scoping rules, or access to a pointer-to-it or something. In real call-by-name the data item would change as soon as the parameter is modified by the subroutine. In the proposed scheme the transfer does not take place until the subroutine returns. > ... Univac's PLUS compiler. It stored its arguments directly > into the callee's statically declared variables and grabbed the results > after the callee returned. Ask zben@umd[25] about this if you care. Well, since Plus was to be written in Plus there was the old bootstrap problem. The solution taken was to hack beat and fiddle an existing Jovial [1] compiler to be the Plus compiler. The stuff-into-callee's static-data-area scheme Jim refers to was inherited from the old code. He's also been away from things awhile - Plus Plus (the second generation compiler) has been here for years now, and it uses a slightly more conventional scheme - the arguments are built on the end of the data stack and in the process of calling the subroutine the stack pointer is pushed just enough to make the arguments the first N locals of the called routine. Perhaps my usage of "stack pointer" is unusual here - the 1100 does not have any builtin stack so stacks must be implemented with index registers. What I called "stack pointer" here is what many people call "frame pointer". [1] Jules schwartz's Own Version of the International Algebraic Language Or some YABA [2] like that... [2] Yet Another (questioned parentage) ALGOL... Cheers -- umd5.UUCP <= {seismo!umcp-cs,ihnp4!rlgvax}!cvl!umd5!zben Ben Cranston zben @ umd2.UMD.EDU Kingdom of Merryland Sperrows 1100/92 umd2.BITNET "via HASP with RSCS"