[gclist] What to say about GC (and free GC support SW for C/C++)

Hans Boehm boehm@hoh.mti.sgi.com
Fri, 26 Jul 1996 10:12:51 -0700


"Background: SCM is a C-coded Scheme interpreter that relies very
heavily---and in my view, unnecessarily---on conservative pointer
finding, for simple interoperability with code written in C."

If I rememember correctly, and if it hasn't changed, it uses one extra level of
indirection.  The interpreter refers to object handles, which point to the
associated data.  It scans conservatively for pointers to the handle objects.
 If C code has a pointer to the data and not a pointer to the handle, it loses.
 This is dangerous, since the C compiler may deduce that the handle pointer is
dead and not keep it around. I think the original claim was that this is OK,
since only a small amount of C code has to play by these rules, and it can be
written very defensively to avoid compiler optimization problems, etc.

If my recollection is correct, then any problems with SCM and C
interoperability should not be generalized to anything else.  Our conservative
collector is also not robust against all otherwise safe C-compiler
optimizations (cf. my paper in the last PLDI Proceedings).  But I would guess
there are several orders of magnitude difference in the risk of breakage for
naively written and optimized C code.

Hans

-- 
Hans-Juergen Boehm
boehm@mti.sgi.com