From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "Jose E. Marchesi" Newsgroups: gmane.lisp.guile.devel Subject: [RFC,PATCH] Do not GC_INIT the Boehm GC if already initialized Date: Mon, 06 Feb 2023 19:34:05 +0100 Message-ID: <87ttzybq3m.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37354"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: ludo@gnu.org To: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Mon Feb 06 21:49:04 2023 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 1pP8QA-0009VW-KE for guile-devel@m.gmane-mx.org; Mon, 06 Feb 2023 21:49:02 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pP8Pk-0008Rg-VY; Mon, 06 Feb 2023 15:48:38 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pP6Jg-00059N-PJ for guile-devel@gnu.org; Mon, 06 Feb 2023 13:34:14 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pP6Jg-0002MR-H8; Mon, 06 Feb 2023 13:34:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:Subject:To:From:in-reply-to: references; bh=wJO2bbCwJIZaxPKZ4rD7raN7j5stZ+IzoOPWP1FVCDg=; b=cxa14zoqbTvZP1 ZTd/ct0FUPxmZSQLsKNVnMO1qRK/9cs9UisctBwv1A/XOGGCG/CHTN5WHO4l4dxy0Bb1KU7ifQ2tr JUNlR34KMT2wXG+J3x+mi3KWKUwYEZTcvcGrMfexIQiEAawQ4eXn9I851kP1JVXPHuwQgR0d96ZQJ 8AIeliPe8WwQz+ZrLGk+OuBWIWQNf9sdoVR8S0b8zHniEIP+iAWMVv8Y7/7/PcjR3wzWaMQMaA1eU Iy0kq8OPC82I5l1JwevL0tca1eFmJ0vJ9mxr6G/hvsZREdJHxjhKlO48KVtfVWhCm0NmA0UXLQly/ f8X806yoDc3TGxh/8Yrg==; Original-Received: from [141.143.193.70] (helo=termi) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pP6Jf-0000Y6-0Y; Mon, 06 Feb 2023 13:34:11 -0500 X-Mailman-Approved-At: Mon, 06 Feb 2023 15:48:07 -0500 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.29 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-bounces+guile-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.devel:21688 Archived-At: Hello Guile hackers. We are in the process of integrating GNU poke[1] in GDB by mean of libpoke. Problem is, libpoke uses the Boehm GC, as guile does. We are working on switching to an ad-hoc exact collector, but it will get some time. So, in the interim, we may: 1) Make both libguile and libpoke to do GC_INIT conditionally, only if no one else has initialized the collector before. This is already in poke master. A suggested (untested!) patch for guile below. 2) Test to see if the collector works properly. 3) Do bug-fix releases of both libguile and libpoke so the GDB people can check for the right version in configure.ac in order to allow configuring GDB with both libpoke and libguile support. Does this sound like a plan? Thanks in advance! [1] https://jemarch.net/poke diff --git a/libguile/gc.c b/libguile/gc.c index 7717e9bef..36653d373 100644 --- a/libguile/gc.c +++ b/libguile/gc.c @@ -462,7 +462,8 @@ scm_storage_prehistory () setenv ("GC_MARKERS", "1", 1); #endif - GC_INIT (); + if(!GC_is_init_called ()) + GC_INIT (); size_t heap_size = GC_get_heap_size (); if (heap_size < DEFAULT_INITIAL_HEAP_SIZE)