From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Christine Lemmer-Webber Newsgroups: gmane.lisp.guile.devel Subject: Re: Ephemerons, self-referentality in weak hashtables Date: Wed, 08 Sep 2021 16:50:56 -0400 Message-ID: <877dfqaj0k.fsf@dustycloud.org> References: <87vb9ihy6x.fsf@igalia.com> <87czto11vd.fsf@dustycloud.org> <4ddb8c54cdbdcaf1644ce07bb5cad261ebb86600.camel@telenet.be> <8b9906861b138901e0ed17f640506d70a686ec51.camel@telenet.be> <87fsuf9h1f.fsf@dustycloud.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5386"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.6.2; emacs 27.2 Cc: Andy Wingo , guile-devel@gnu.org To: Maxime Devos Original-X-From: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Wed Sep 08 22:51:32 2021 Return-path: Envelope-to: guile-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mO4Xc-0001A5-LW for guile-devel@m.gmane-mx.org; Wed, 08 Sep 2021 22:51:32 +0200 Original-Received: from localhost ([::1]:39720 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mO4Xa-0006Og-If for guile-devel@m.gmane-mx.org; Wed, 08 Sep 2021 16:51:30 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42234) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mO4XI-0006Ll-0R for guile-devel@gnu.org; Wed, 08 Sep 2021 16:51:12 -0400 Original-Received: from dustycloud.org ([50.116.34.160]:58566) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mO4XG-0004Y9-FZ for guile-devel@gnu.org; Wed, 08 Sep 2021 16:51:11 -0400 Original-Received: from twig (localhost [127.0.0.1]) by dustycloud.org (Postfix) with ESMTPS id 37D932661B; Wed, 8 Sep 2021 16:51:08 -0400 (EDT) In-reply-to: Received-SPF: pass client-ip=50.116.34.160; envelope-from=cwebber@dustycloud.org; helo=dustycloud.org X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Original-Sender: "guile-devel" Xref: news.gmane.io gmane.lisp.guile.devel:20849 Archived-At: Maxime Devos writes: > [[PGP Signed Part:Undecided]] > Christine Lemmer-Webber schreef op wo 08-09-2021 om 12:18 [-0400]: >> Maxime Devos writes: >>=20 >> > [[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, >> > > >=20 >> > > > 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 curr= ent >> > > > actor references to their current behavior. I found that for >> > > > self-referential actors, I needed ephemerons for GC stuff to work = right. >> > >=20 >> > > [bla bla on how this could be implemented in Guile] >> >=20 >> > 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. >> >=20 >> > Greetings, >> > Maxime. >>=20 >> 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 =E2=80=98disclaimer=E2=80=99 support is disabled by default, a config= uration flag > needs to be set while compiling libgc to use disclaimers. Guix (the dist= ro 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 =E2=80=98freed=E2=80=99 objects would be re-used). > > I think it can be made to work, but I didn't succeed, and moved on to oth= er > things. If someone would like to implement this, I would recommend start= ing > with something like =E2=80=98ephemeral pairs=E2=80=99 before moving to ep= hemeral hash tables. > > Greetings, > Maxime. Okay... thank you for the work you put into it! :)