home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / sys / acorn / tech / 45 < prev    next >
Encoding:
Internet Message Format  |  1992-08-13  |  2.5 KB

  1. From: kers@hplb.hpl.hp.com (Chris Dollin)
  2. Date: Fri, 14 Aug 1992 07:55:17 GMT
  3. Subject: Re: New Language/Compiler (ideas wanted)
  4. Message-ID: <KERS.92Aug14085518@cdollin.hpl.hp.com>
  5. Organization: Hewlett-Packard Laboratories, Bristol, UK.
  6. Path: sparky!uunet!usc!sdd.hp.com!hpscdc!hplextra!otter.hpl.hp.com!hpltoad!cdollin!kers
  7. Newsgroups: comp.sys.acorn.tech
  8. References: <1195@grun.is> <1992Aug13.130618.18871@odin.diku.dk> <1992Aug13.205528.15434@cs.aukuni.ac.nz>
  9. Sender: news@hplb.hpl.hp.com (Usenet News Administrator)
  10. Lines: 37
  11. In-Reply-To: jwil1@cs.aukuni.ac.nz's message of Thu, 13 Aug 1992 20:55:28 GMT
  12. Nntp-Posting-Host: cdollin.hpl.hp.com
  13.  
  14. In article ... jwil1@cs.aukuni.ac.nz (TMOTA) writes:
  15.  
  16.    torbenm@diku.dk (Torben AEgidius Mogensen) writes:
  17.  
  18.    >Afeature I have sorely missed in compilers for C etc. is a cheap
  19.    >tail-call: if the last thing you do in a procedure or function is to
  20.    >call a procedure or function, this can be implemented as a goto rather
  21.    >than a general procedure/function call. Also, the local variables of
  22.  
  23.    What do you mean? What if the tail-called function then tries to call
  24.    another function or (even worse) recurses? This could only work if
  25.    the tail-called function expected to recieve *exactly* the stack frame
  26.    that the tail-caller has had set up when it was called.
  27.  
  28. Urk? You clean up the stack before you call the tail-called function, of
  29. course. It's a standard optimisation, at least in the Lisp world. [The only
  30. objection to it is that it can make debugging harder -- you lose the functions
  31. that tail-called when you get the stack backtrace.]
  32.  
  33.    And remember that Acorn's C compiler (the ARM proc. call std.?) is clever
  34.    enough to notice when you call a function that does not call another (a
  35.    leaf function), and does not bother with most of the context-storing
  36.    operations involved in normal function calls.
  37.  
  38. I'm not sure you said what you meant. There's no cleverness involved in calling
  39. a leaf function (after all, who's to know that it *is* a leaf function?), it's
  40. just that leaf functions don't need to carry all the baggage of a full function
  41. call -- it's the code of the leaf that ``does not bother with most of the
  42. context-storing operations''. [They don't carry the baggage because there's
  43. very little that can go wrong inside them, so they don't need to record who
  44. they are in case something does.]
  45.  
  46.  
  47. --
  48.  
  49. Regards,    | It's strange how you suddenly discover bizarre and dangerous
  50. Kers.       | holes in your knowledge.  I fell down one today. - Steve Knight
  51.