[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Ephemerons, self-referentality in weak hashtables
From: |
Maxime Devos |
Subject: |
Re: Ephemerons, self-referentality in weak hashtables |
Date: |
Wed, 08 Sep 2021 22:11:31 +0200 |
User-agent: |
Evolution 3.34.2 |
Christine Lemmer-Webber schreef op wo 08-09-2021 om 12:18 [-0400]:
> Maxime Devos <maximedevos@telenet.be> writes:
>
> > [[PGP Signed Part:Undecided]]
> > Maxime Devos schreef op zo 20-06-2021 om 17:01 [+0200]:
> > > Christopher Lemmer Webber schreef op di 18-05-2021 om 11:46 [-0400]:
> > > > Hello,
> > > >
> > > > I'm finally taking some time to port Goblins to Guile, in-between other
> > > > tasks anyway. In Goblins there is a weak hashtable that maps current
> > > > actor references to their current behavior. I found that for
> > > > self-referential actors, I needed ephemerons for GC stuff to work right.
> > >
> > > [bla bla on how this could be implemented in Guile]
> >
> > This doesn't work because there is nothing preventing the
> > 'value' from being freed. Trying to fix that now, using
> > the example implementation of "weak maps" in libgc.
> >
> > Greetings,
> > Maxime.
>
> I fell off the radar on replying to this, but did path turn out to work?
The example implementation was a bit complicated and not well-documented.
The ‘disclaimer’ support is disabled by default, a configuration flag
needs to be set while compiling libgc to use disclaimers. Guix (the distro I
use) doesn't set it. I needed to be careful in libguile/weak-table.c to not
protect too much (otherwise it wouldn't be an ephemeral weak hash table) or
too little (otherwise ‘freed’ objects would be re-used).
I think it can be made to work, but I didn't succeed, and moved on to other
things. If someone would like to implement this, I would recommend starting
with something like ‘ephemeral pairs’ before moving to ephemeral hash tables.
Greetings,
Maxime.
signature.asc
Description: This is a digitally signed message part