On Mon, 3 Apr 2023 02:09:51 +0200, Bernd Oppolzer wrote: >Now I'll try an answer to the other question(s), see below ... > >Am 03.04.2023 um 01:32 schrieb Paul Gilmartin: >> Are the external semantics (not examining the generated assembly) of >> "pass by content" any different from "pass by value"? How? > >maybe not > >> It would seem more efficient for the called function to perform the copy >> rather than the caller because the code to perform the copy would exist >> only once in the subroutine rather than at each point of call. > >I don't think so. > >If the copy would be done by the called routine, you would need two >copies ... >first you would need to copy the addresses of the parameters to the stack >(because otherwise the called routine would not know where to copy the >parameters from) >and then the second copy in the called routine, which copies the values >from the original place >in the caller's area to the stack frame of the called routine. This >takes more time to do it >and additional stack space for the address list, and: this is true IMO, >no matter what platform >you are running on. It is therefore better to copy the values to the >parameter list directly and >this must be done by the caller; the caller has to prepare the parameter >list. BTW: this is done >this way by every compiler that I am aware of, my New Stanford Pascal >compiler and every >other compiler that I have examined in the last years, different platforms. > >This is maybe a time to space tradeoff, in the end ... but all compilers >decide for time saving. > I doubt there's a significant performance difference between the caller's copying the content and the callee's doing so. It may have been more important to preserve compatibility with support tools: debuggers and dump analyzers which depend on the reg1 PL containing addresses of parameters seen by the callee, even in an asynchronous snapshot.
From the HLL point of view, "call by content" is "call by value" with an idiosyncratic name for identical semantics. -- gil ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN