Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!udel!eplrx7!leipold From: leipold@eplrx7.uucp (Walt Leipold) Newsgroups: comp.lang.c Subject: Garbage (collection, that is...) Summary: Is this portable? Is it good enough? Message-ID: <1991May6.202321.18562@eplrx7.uucp> Date: 6 May 91 20:23:21 GMT Sender: usenet@ee.udel.edu Organization: DuPont Neural Network Technology Center Lines: 32 Nntp-Posting-Host: louie.udel.edu I've been looking at Scheme as an extension language for some otherwise- portable code, with particular attention to a pair of public-domain interpreters named "scm" and "siod" (scm is actually an adaptation of siod). While these interpreters are small and complete, their implementations include a detail that raises my hackles: both of 'em garbage-collect directly from the C stack and the registers. Of course, gc'ing from the stack permits automatic C variables to be used as Scheme CONS cells, which makes the interpreter *much* simpler. But my palms always sweat when I see code that uses #define STACKS_GROW_UP... The stack is gc'd by saving the address of a main-program automatic variable, and scanning between there and the address of a current auto variable for anything that looks like a Scheme pointer. Registers are gc'd by calling setjmp() and then examining the register values saved in the jmp_buf structure. As a Portability Paranoid(TM), I find this frightening, since (for instance) I don't think that C is even required to use a stack to store activation records. I'm pretty sure that gc'ing off the C stack is non-portable practice. Is it *good* practice? In how many current implementations are C activation records *not* allocated contiguously on a stack? Should I look elsewhere for a Scheme interpreter? (Or am I worrying too much?) Thanks.... -- -------------------------------------------------------------------------- "When dealing with the insane, Walt Leipold it is best to pretend to be sane." (leipolw%esvax@dupont.com) -------------------------------------------------------------------------- -- The UUCP Mailer