From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ludovic.courtes@laas.fr (Ludovic =?iso-8859-1?Q?Court=E8s?=) Newsgroups: gmane.lisp.guile.devel Subject: [PATCH] Fixing `gc-live-object-stats' Date: Thu, 17 Nov 2005 14:21:32 +0100 Organization: LAAS-CNRS Message-ID: <87r79f4dgj.fsf@laas.fr> References: <87y83z3vh5.fsf@laas.fr> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: sea.gmane.org 1132235739 7941 80.91.229.2 (17 Nov 2005 13:55:39 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 17 Nov 2005 13:55:39 +0000 (UTC) Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Thu Nov 17 14:55:30 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EckCa-0000Dd-IA for guile-devel@m.gmane.org; Thu, 17 Nov 2005 14:53:25 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EckCZ-0003Bg-Mp for guile-devel@m.gmane.org; Thu, 17 Nov 2005 08:53:23 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EcjiO-0000UT-2s for guile-devel@gnu.org; Thu, 17 Nov 2005 08:22:12 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EcjiH-0000RQ-5N for guile-devel@gnu.org; Thu, 17 Nov 2005 08:22:07 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EcjiG-0000RE-Vk for guile-devel@gnu.org; Thu, 17 Nov 2005 08:22:04 -0500 Original-Received: from [140.93.0.15] (helo=laas.laas.fr) by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1EcjiG-0005Qy-NM for guile-devel@gnu.org; Thu, 17 Nov 2005 08:22:05 -0500 Original-Received: by laas.laas.fr (8.13.1/8.13.4) with SMTP id jAHDM1QO002910; Thu, 17 Nov 2005 14:22:02 +0100 (CET) Original-To: guile-devel@gnu.org X-URL: http://www.laas.fr/~lcourtes/ X-Revolutionary-Date: 27 Brumaire an 214 de la =?iso-8859-1?Q?R=E9volution?= X-PGP-Key-ID: 0xEB1F5364 X-PGP-Key: http://www.laas.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 821D 815D 902A 7EAB 5CEE D120 7FBA 3D4F EB1F 5364 X-OS: powerpc-unknown-linux-gnu Mail-Followup-To: guile-devel@gnu.org In-Reply-To: <87y83z3vh5.fsf@laas.fr> (Ludovic =?iso-8859-1?Q?Court=E8s's?= message of "Tue, 08 Nov 2005 18:22:46 +0100") User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux) X-Spam-Score: 0 () X-Scanned-By: MIMEDefang at CNRS-LAAS X-MIME-Autoconverted: from 8bit to quoted-printable by laas.laas.fr id jAHDM1QO002910 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:5401 Archived-At: Hi, ludovic.courtes@laas.fr (Ludovic Court=E8s) writes: > $ guile > guile> (gc-live-object-stats) > Segmentation fault (core dumped) The patch below fixes this problem. Basically, what happens when doing this is that `scm_i_card_statistics ()' gets called on yet uninitialized cards. This is normal because cards are initialized lazily at sweep time by `scm_i_sweep_some_cards ()' which calls `scm_i_init_card_freelist ()' if needed. BTW, looking at the code of `scm_i_sweep_some_cards ()', it looks like cards can be initialized more than once in the event where THRESHOLD is reached before NEXT_FREE reached the upper boundary of SEG. In such a case, SEG->FIRST_TIME will remain equal to 1, and thus, the next time this function is called on SEG, `scm_i_init_card_freelist ()' will be called again for each of SEG's cards. Did I miss something? Thanks, Ludovic. 2005-11-17 Ludovic Court=E8s * gc-card.c (scm_i_card_statistics): Return if BITVEC is NULL. This was typically hit when running `gc-live-object-stats' right after starting Guile. --- orig/libguile/gc-card.c +++ mod/libguile/gc-card.c @@ -306,6 +306,10 @@ int span =3D seg->span; int offset =3D SCM_MAX (SCM_GC_CARD_N_HEADER_CELLS, span); =20 + if (!bitvec) + /* Card P hasn't been initialized yet by `scm_i_init_card_freelist (= )'. */ + return; + for (p +=3D offset; p < end; p +=3D span, offset +=3D span) { scm_t_bits tag =3D -1; _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://lists.gnu.org/mailman/listinfo/guile-devel