Pie Squared <PieSquared@[EMAIL PROTECTED]
> wrote:
> Is it possible to make a conservative moving GC?
>
Depends on what you consider to be a conservative GC and what you
consider a moving GC. I do not think that purely conservative
GC can be moving -- by purely convervative I mean that all
pointers you see are only potential pointers and the only assumption
on code is that all pointers are visible (and I assume conventional
architecture).
But there are useful partially convervative collectors. Namely,
if heap objects are tagged, then you can precisely identify pointers
contained in a given object and you can safely update them. At first
glance this looks like a precise collector. But root pointers may
be only potential pointers. For example, if you allow starting
garbage collection from an interrupt handler, then you may not
know which machine registers are pointers and which are integeres.
If you use C as intermediate language, then probably all words
on the C stack are potential pointers. In such sitation reasonable
policy is to keep fxed all objects referenced by potential pointers,
but to move live objects unreferenced by any potential pointer.
AFAIK such method is used in some Lisp implementations. Namely,
sbcl GC is conservative with respect to machine registers, but
precise otherwise. Also gcl knows that at GC time some objects
can not have references from the stack, so it moves them (but
some kinds of objects are never moved).
--
Waldek Hebisch
hebisch@[EMAIL PROTECTED]


|