emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Recent GCPRO removal and copying GC


From: Stefan Monnier
Subject: Re: Recent GCPRO removal and copying GC
Date: Fri, 18 Sep 2015 23:54:38 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

> I am concerned this change might make it much harder to switch to a copying
> garbage collector in the future, or to integrate Emacs with an existing
> garbage collector of such design.

I don't think it would make much difference.  The variables marked with
GCPRO did not cover *all* places where the corresponding object addresses
could be found in the stack.  Only "enough addresses" so that the object
we needed were not GC'd.  IOW they were (barely) sufficient to keep all
objects alive (at least, so it seemed), but they were not sufficient to
find all existing pointers when moving objects.

The difference may seem small, but in order to use a fully moving GC
we'd need to fill this gap somehow, and all the ways I can think of to
fill this gap end up not needing the GCPROs anyway.

And of course, we can still use a partially-moving GC (where objects
reachable from the stack are pinned).  Such a GC could potentially
benefit from GCPROs in that we could limit the "pinning" to those
objects reachable from a stack location which is not in the GCPRO set,
but I'm far from convinced that it would be worth the trouble: Emacs
often performs GC with an empty stack, so we should be able to bring the
"pinned" objects to something very small anyway even without GCPRO.

And of course, all this is hypothetical: the need/desire for a better GC
has existed from the last 20 years at least, and yet here we are.
So it's likely that our naive mark&sweep will still be with us for
a long time.


        Stefan



reply via email to

[Prev in Thread] Current Thread [Next in Thread]