emacs-devel
[Top][All Lists]
Advanced

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

Re: Collecting markers with MPS


From: Helmut Eller
Subject: Re: Collecting markers with MPS
Date: Thu, 25 Apr 2024 11:44:43 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

On Wed, Apr 24 2024, Gerd Möllmann wrote:

> Yes, it makes sense. One could of course use a timer. Or maybe, don't
> know, run something when we handle an MPS message. That just occurred to
> me a second ago, so it might be nonsense.

A variation could be this: we split the marker type up into three parts.
One part is only handled by the C code (malloc-ed, non-moving,
reference-counted), the second part is handed out to Lisp, and the third
part is specifically for the undo-list.

The Lisp part is basically a pointer to the C part, but it has a
finalizer that decrements the reference count in the C part.

The third part is also a pointer to the C part, but the C part also
keeps a (traced) reference to this part.  When the reference count drops
to zero, we can set the pointer from the undo-list to the C part so 0.
Ie. this is basically weak reference, implemented manually.

An advantage of this scheme is that the GC only needs to support
finalization.  Also, the involved changes would likely work for both the
old GC and the new GC.  Which might be an issue if the new GC remains a
purely optional feature.

Helmut



reply via email to

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