emacs-devel
[Top][All Lists]
Advanced

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

Re: MPS signals and Emacs


From: Gerd Möllmann
Subject: Re: MPS signals and Emacs
Date: Mon, 22 Apr 2024 12:22:25 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

Eli Zaretskii <eliz@gnu.org> writes:

> Doesn't copying GC work by copying live objects to a new memory
> region, and then freeing the old region?  If so, if some objects
> cannot be moved, how can the old region be freed?

Yes. A simple precise GC (no support for ambiguous references) might
work with 2 regions, which are usually called to-space and froms-space.
When a GC happens, everything live is copied from from-space to
to-space. At the end, to-space has all live objects, and both spaces can
switch roles in the next GC.

That doesn't work with ambigupus references, of course.

Instead imagine a memory area that is divided into a number of
subregions, let's say into VM pages, I think that's a good example. Add
to that some administrative data structures holding information about
pages, say if it's part of to-space or from-space. Just as an example,
there are so many variations, of this...

Now a GC happens. We can copy objects from a pages in from-space to a
page in to-soace, and everything works as in the copying collector, in
principle. At the end, we just switch what we consider to-space and
from-space. Maybe a 1 in the page info data structure formerly stood for
to-space and 0 for to-space. Now exchange the meaning of 0 and 1.

Ok, I hope. Now say we have an ambiguous reference to an object O in
page P. We can copy the objects as above, but not O, which we leave
where it is. At the end of the GC, we move P to to-space by simply
changing its number in the page info data. Mission accomplished.

Hm, I have to add that this is such a drastically oversimplifying
horrible description that I slmost get a bad conscience. Almost ;-).



reply via email to

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