Subject: Re: Implementation issues
From: rpw3@rigden.engr.sgi.com (Rob Warnock)
Date: 1998/07/17
Newsgroups: comp.lang.scheme
Message-ID: <6omq0e$2mbs@fido.engr.sgi.com>
Andy Gaynor  <silver@mail.webspan.net> wrote:
+---------------
| Overall, which do you think is better, putting activation
| records in the heap or maintaining a stack for them?
+---------------

Have you read this yet?

    Dybvig, R. Kent. "Three Implementation Models for Scheme".
    University of North Carolina Computer Science Technical
    Report 87-011 [Ph.D.  Dissertation], April 1987.
    <URL:ftp://ftp.cs.indiana.edu/pub/scheme-repository/doc/pubs/3imp.ps.gz>

+---------------
| The deciding vote, I guess, is that the ratio of continuation usage
| to the normal creation and reclamation of activation records is low.
| So stack wins.
+---------------

Usually. But there are some, e.g.:

    Appel, Andrew W. "Simple generational garbage collection and fast
    allocation". Software Practice and Experience, 19(2):171-183, 1989.
    <URL:http://www.cs.princeton.edu/faculty/appel/papers/143.ps>

who would say that with a high-quality generational garbage collector,
especially one that uses a generation-0 "nursery" that's matched to the
secondary cache size [per Ungar], that heap-based allocation can be as
fast & efficient as stack-based allocation. (And then there's Henry Baker's
"Cheney on the MTA" <URL:ftp://ftp.netcom.com/pub/hb/hbaker/CheneyMTA.html>,
which uses the C stack *as* generation-0, but that's another story...)

So while the vast majority of performance-oriented implementations use
a linear stack for activation records, it's not necessarily the *only*
"right" way...


-Rob

-----
Rob Warnock, 7L-551		rpw3@sgi.com   http://reality.sgi.com/rpw3/
Silicon Graphics, Inc.		Phone: 650-933-1673
2011 N. Shoreline Blvd.		FAX: 650-933-4392
Mountain View, CA  94043	PP-ASEL-IA