[gclist] GC FAQ & uncooperative environments

Fergus Henderson fjh@cs.mu.OZ.AU
Fri, 11 Jul 2003 03:54:31 +1000

On 10-Jul-2003, Marcin 'Qrczak' Kowalczyk <qrczak@knm.org.pl> wrote:
> Funny, I've just written a copying garbage collector for C code generated by 
> my compiler :-)
> Quite similar to Qish. Completely untested, as the rest of the compiler is not
> ready yet. Unlike Qish it doesn't rely on memory layout of argument lists and 
> local variable lists, so it doesn't matter if the C compiler performs 
> optimizations - it uses almost legal C to find pointers. The stack is 
> simulated anyway for other reasons.

You don't need to resort to "almost legal C" to find pointers;
if the C code is automatically generated by your compiler, then
you can use strictly conforming standard C code to find all the
pointers.  The technique is discussed in my ISMM'02 paper [2].

I recently found out that I was not the first to use such a
technique in the context of compiling to C; Burgess, Perry, and Pointon
used a quite similar technique in their Hope+C compiler [1].


[1]	"The Concurrent Massey Hope+C Functional Language System"
	Peter Burgess, Nigel Perry, and Robert Pointon.
	Massey University Report Number ISBN 0-473-06203-8, 1999.
	(Available on request from Nigel Perry.)

[2]	"Accurate garbage collection in an uncooperative environment",
	Fergus Henderson.
	Proceedings of the 2002 International Symposium on Memory
	Management, Berlin, Germany, June 2002, pages 150-156.

Fergus Henderson <fjh@cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.