🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.acorn.tech
Article #128

Re: New Language/Compiler (ideas wanted)

#128
From: Chris Dollin
Date: Fri, 14 Aug 1992 07:55
37 lines
2587 bytes
In article ... jwil1@cs.aukuni.ac.nz (TMOTA) writes:

   torbenm@diku.dk (Torben AEgidius Mogensen) writes:

   >Afeature I have sorely missed in compilers for C etc. is a cheap
   >tail-call: if the last thing you do in a procedure or function is to
   >call a procedure or function, this can be implemented as a goto rather
   >than a general procedure/function call. Also, the local variables of

   What do you mean? What if the tail-called function then tries to call
   another function or (even worse) recurses? This could only work if
   the tail-called function expected to recieve *exactly* the stack frame
   that the tail-caller has had set up when it was called.

Urk? You clean up the stack before you call the tail-called function, of
course. It's a standard optimisation, at least in the Lisp world. [The only
objection to it is that it can make debugging harder -- you lose the functions
that tail-called when you get the stack backtrace.]

   And remember that Acorn's C compiler (the ARM proc. call std.?) is clever
   enough to notice when you call a function that does not call another (a
   leaf function), and does not bother with most of the context-storing
   operations involved in normal function calls.

I'm not sure you said what you meant. There's no cleverness involved in calling
a leaf function (after all, who's to know that it *is* a leaf function?), it's
just that leaf functions don't need to carry all the baggage of a full function
call -- it's the code of the leaf that ``does not bother with most of the
context-storing operations''. [They don't carry the baggage because there's
very little that can go wrong inside them, so they don't need to record who
they are in case something does.]


--

Regards,    | It's strange how you suddenly discover bizarre and dangerous
Kers.       | holes in your knowledge.  I fell down one today. - Steve Knight
Technical Details
Message-ID: <KERS.92Aug14085518@cdollin.hpl.hp.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!usc!sdd.hp.com!hpscdc!hplextra!otter.hpl.hp.com!hpltoad!cdollin!kers
References: <1195@grun.is> <1992Aug13.130618.18871@odin.diku.dk> <1992Aug13.205528.15434@cs.aukuni.ac.nz>

Show Full Headers
Complete Article Headers
From: kers@hplb.hpl.hp.com (Chris Dollin)
Date: Fri, 14 Aug 1992 07:55:17 GMT
Subject: Re: New Language/Compiler (ideas wanted)
Message-ID: <KERS.92Aug14085518@cdollin.hpl.hp.com>
Organization: Hewlett-Packard Laboratories, Bristol, UK.
Path: arc1-ca.pugleaf.net!sparky!uunet!usc!sdd.hp.com!hpscdc!hplextra!otter.hpl.hp.com!hpltoad!cdollin!kers
Newsgroups: comp.sys.acorn.tech
References: <1195@grun.is> <1992Aug13.130618.18871@odin.diku.dk> <1992Aug13.205528.15434@cs.aukuni.ac.nz>
Sender: news@hplb.hpl.hp.com (Usenet News Administrator)
Lines: 37
In-Reply-To: jwil1@cs.aukuni.ac.nz's message of Thu, 13 Aug 1992 20:55:28 GMT
Nntp-Posting-Host: cdollin.hpl.hp.com