Re: When/why did function calls get cheap?

bonzini@gnu.org (Paolo Bonzini)
14 Mar 2003 11:07:55 -0500

          From comp.compilers

Related articles
[11 earlier articles]
Re: When/why did function calls get cheap? gah@ugcs.caltech.edu (Glen Herrmannsfeldt) (2003-02-24)
Re: When/why did function calls get cheap? alexc@std.com (Alex Colvin) (2003-02-24)
Re: When/why did function calls get cheap? vbdis@aol.com (2003-02-24)
Re: When/why did function calls get cheap? firefly@diku.dk (Peter Finderup Lund) (2003-03-09)
Re: When/why did function calls get cheap? joachim_d@gmx.de (Joachim Durchholz) (2003-03-09)
Re: When/why did function calls get cheap? klimas@klimas-consulting.com (Andreas Klimas) (2003-03-09)
Re: When/why did function calls get cheap? bonzini@gnu.org (2003-03-14)
Re: When/why did function calls get cheap? jcrens@earthlink.net (Jack Crenshaw) (2003-03-14)
Re: When/why did function calls get cheap? david.thompson1@worldnet.att.net (David Thompson) (2003-03-22)
Re: When/why did function calls get cheap? alex_mcd@btopenworld.com (Alex McDonald) (2003-03-22)
Re: When/why did function calls get cheap? tenger@idirect.com (Terrence Enger) (2003-03-23)
Re: When/why did function calls get cheap? gah@ugcs.caltech.edu (Glen Herrmannsfeldt) (2003-03-24)
| List of all articles for this month |

From: bonzini@gnu.org (Paolo Bonzini)
Newsgroups: comp.compilers
Date: 14 Mar 2003 11:07:55 -0500
Organization: http://groups.google.com/
References: 03-02-073 03-02-101 03-02-134 03-03-010
Keywords: architecture, design
Posted-Date: 14 Mar 2003 11:07:55 EST

> They don't call -- they jump. The fancy thing about CPS is that you
> get rid of some special cases: you don't have to handle things
> differently for tail calls and ordinary calls (in principle) because
> both are just parameter passing andjumps. You also don't have to
> handle both a stack and a heap -- you can easily make do with only a
> heap (SML/NJ does that).


It makes sense however to make the heap able to do at least limited
LIFO allocation, instead of relying completely on the garbage
collector. GNU Smalltalk has heap-allocated activation records
(coupled with continuation passing when using the just-in-time
compiler), but the heap is not the same heap where other objects are
allocated: instead it is special in that if an activation record and
all of its children create no closure, then it can be quickly
deallocated.


I find that around 90% of the activation records can be GCed this way.


(Actually this is not strictly related to continuation-passing, but to
every implementation of heap-allocated activation records. These are
an extraordinarily expensive way to do function calls, just to keep in
topic with the subject of the message...)


Paolo


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.