From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Han-Wen Nienhuys Newsgroups: gmane.lisp.guile.devel Subject: Re: module GC bug Date: Thu, 14 Jul 2005 00:19:28 +0200 Message-ID: <42D59370.7080802@xs4all.nl> References: <42A8D188.20007@xs4all.nl> <87fyuq1mrr.fsf@zagadka.de> <42CEF39F.2040608@xs4all.nl> <87irzeh122.fsf@zagadka.de> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1121323688 29662 80.91.229.2 (14 Jul 2005 06:48:08 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 14 Jul 2005 06:48:08 +0000 (UTC) Cc: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Thu Jul 14 08:48:05 2005 Return-path: Original-Received: from mail-relay.eunet.no ([193.71.71.242]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DsxMg-0004tz-OM for guile-devel@gmane.org; Thu, 14 Jul 2005 08:38:34 +0200 Original-Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) by mail-relay.eunet.no (8.13.1/8.13.1/GN) with ESMTP id j6DMLnkl020516 for ; Thu, 14 Jul 2005 00:21:49 +0200 (CEST) (envelope-from guile-devel-bounces+guile-devel=m.gmane.org@gnu.org) Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Dspde-0003VO-GR for guile-devel@m.gmane.org; Wed, 13 Jul 2005 18:23:34 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DspdE-0003KQ-Ey for guile-devel@gnu.org; Wed, 13 Jul 2005 18:23:08 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Dspd5-0003Gf-Oo for guile-devel@gnu.org; Wed, 13 Jul 2005 18:23:01 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Dspd4-0003FG-MI for guile-devel@gnu.org; Wed, 13 Jul 2005 18:22:58 -0400 Original-Received: from [194.109.24.34] (helo=smtp-vbr14.xs4all.nl) by monty-python.gnu.org with esmtp (Exim 4.34) id 1DspeH-0007hD-NW for guile-devel@gnu.org; Wed, 13 Jul 2005 18:24:14 -0400 Original-Received: from [192.168.123.107] (muurbloem.xs4all.nl [213.84.26.127]) by smtp-vbr14.xs4all.nl (8.13.3/8.13.3) with ESMTP id j6DMFxci008746; Thu, 14 Jul 2005 00:15:59 +0200 (CEST) (envelope-from hanwen@xs4all.nl) User-Agent: Mozilla Thunderbird 1.0.2-6 (X11/20050513) X-Accept-Language: en-us, en Original-To: Marius Vollmer In-Reply-To: <87irzeh122.fsf@zagadka.de> X-Virus-Scanned: by XS4ALL Virus Scanner X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:5163 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:5163 Marius Vollmer wrote: > Han-Wen Nienhuys writes: > > >>>I think the right fix is to change the weak hashtable marking >>>algorithm to properly cope with circular references like this. I will >>>try this and then come back to you. >> >>Interesting. How would you go about doing that? > > > The marking would would rougly look like this (some special cases are > not considered, like improper alists): > > mark OBJ: > if mark of OBJ is set: > return > set mark of OBJ > if OBJ is a weak vector > put it on POSTPONED_OBJECTS > else > mark references of OBJ > > gc: > POSTPONED_OBJECTS = '() > mark all root references > while POSTPONED_OBJECTS not empty > OBJS = POSTPONED_OBJECTS > POSTPONED_OBJECTS = '() > mark_weak_vector all OBJS > sweep > > mark_weak_vector OBJ: > for all elements ELT of OBJ: > for all pairs P on list ELT: > if P is marked, break > ITEM = car of P > if ITEM is a pair: > if (OBJ has weak keys and car of ITEM is unmarked) > or (OBJ has weak values and cdr of ITEM is unmarked) > remove P from ELT what happens if the weak (c[ad]r ITEM) is marked through a postponed weak vector that you haven't processed yet? Then P is removed erroneously, or am I missing something? -- Han-Wen Nienhuys - hanwen@xs4all.nl - http://www.xs4all.nl/~hanwen _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://lists.gnu.org/mailman/listinfo/guile-devel