From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Han-Wen Nienhuys Newsgroups: gmane.lisp.guile.devel Subject: Re: scm_gc_unprotect during GC Date: Fri, 24 Sep 2004 11:24:42 +0200 Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Message-ID: <16723.59354.746969.639727@byrd.xs4all.nl> References: <16706.21406.130861.89431@byrd.xs4all.nl> <87k6untixh.fsf@zagadka.ping.de> Reply-To: hanwen@xs4all.nl NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1096017957 25888 80.91.229.6 (24 Sep 2004 09:25:57 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 24 Sep 2004 09:25:57 +0000 (UTC) Cc: jantien@xs4all.nl, guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Fri Sep 24 11:25:46 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1CAmKo-0002EC-00 for ; Fri, 24 Sep 2004 11:25:46 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CAmQt-0002mQ-0U for guile-devel@m.gmane.org; Fri, 24 Sep 2004 05:32:03 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1CAmQ5-0002QB-BN for guile-devel@gnu.org; Fri, 24 Sep 2004 05:31:13 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1CAmQ2-0002OJ-Rt for guile-devel@gnu.org; Fri, 24 Sep 2004 05:31:12 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CAmQ1-0002O7-Tl for guile-devel@gnu.org; Fri, 24 Sep 2004 05:31:10 -0400 Original-Received: from [213.84.26.127] (helo=byrd.xs4all.nl) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.34) id 1CAmJi-0004ky-10 for guile-devel@gnu.org; Fri, 24 Sep 2004 05:24:38 -0400 Original-Received: from byrd.xs4all.nl (localhost.localdomain [127.0.0.1]) by byrd.xs4all.nl (8.13.0/8.13.0) with ESMTP id i8O9OhCG023559; Fri, 24 Sep 2004 11:24:43 +0200 Original-To: Marius Vollmer In-Reply-To: <87k6untixh.fsf@zagadka.ping.de> X-Mailer: VM 7.14 under Emacs 21.3.1 X-yoursite-MailScanner-Information: Please contact the ISP for more information X-yoursite-MailScanner: Found to be clean X-MailScanner-From: hanwen@xs4all.nl 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: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.lisp.guile.devel:4160 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:4160 mvo@zagadka.de writes: > Han-Wen Nienhuys writes: > > > A short term solution is to make sure that LilyPond never does > > scm_gc_unprotect_object() from smobbed destructor. However, I feel > > that this is a kludge. > > > > Either scm_gc_unprotect_object is callable during sweep, or this is > > forbidden. At present, GUILE does not print a warning, but barfs in an > > unrelated location. > > Yes, that's unfortunate. Almost anything is forbidden during sweep, > and we need to document that more clearly. In other words, scm_gc_unprotect_object should check whether sweep is in progress, and halt if that is the case. I added this change. > I'd say that a smob free function should not call > scm_gc_unprotect_object, or any other function that accesses the > heap. The heap might be in an inconsistent state, etc. We probably > should list all functions that are callable, starting with just > scm_gc_free. > > Why do you need to call scm_gc_unprotect_object from your smob free > function? To release a SCM value that was in use by the smob? The > usual way to do that is to mark that value in the smob mark function. Laziness, I suppose. We have a precooked Protected_scm class that takes care of calling protect and unprotect. I've changed all our smobs to stop using it. -- 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