unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* [RFC,PATCH] Do not GC_INIT the Boehm GC if already initialized
@ 2023-02-06 18:34 Jose E. Marchesi
  2023-02-06 20:56 ` Jean Abou Samra
  2023-02-07 12:29 ` Maxime Devos
  0 siblings, 2 replies; 7+ messages in thread
From: Jose E. Marchesi @ 2023-02-06 18:34 UTC (permalink / raw)
  To: guile-devel; +Cc: ludo


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)



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [RFC,PATCH] Do not GC_INIT the Boehm GC if already initialized
  2023-02-06 18:34 [RFC,PATCH] Do not GC_INIT the Boehm GC if already initialized Jose E. Marchesi
@ 2023-02-06 20:56 ` Jean Abou Samra
  2023-02-06 21:05   ` Jose E. Marchesi
  2023-02-07 12:29 ` Maxime Devos
  1 sibling, 1 reply; 7+ messages in thread
From: Jean Abou Samra @ 2023-02-06 20:56 UTC (permalink / raw)
  To: Jose E. Marchesi, guile-devel; +Cc: ludo


[-- Attachment #1.1: Type: text/plain, Size: 1670 bytes --]

On 06/02/2023 19:34, Jose E. Marchesi wrote:
> 
> 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)
> 



Isn't that going to cause problems if the configurations clash?
For example, the scm_storage_prehistory () function that you
are modifying does

GC_set_all_interior_pointers (0);

If the application that previously initialized the GC relies
on interior pointer tracing, Guile disabling it is going to
cause trouble.



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFC,PATCH] Do not GC_INIT the Boehm GC if already initialized
  2023-02-06 20:56 ` Jean Abou Samra
@ 2023-02-06 21:05   ` Jose E. Marchesi
  0 siblings, 0 replies; 7+ messages in thread
From: Jose E. Marchesi @ 2023-02-06 21:05 UTC (permalink / raw)
  To: Jean Abou Samra; +Cc: guile-devel, ludo


> On 06/02/2023 19:34, Jose E. Marchesi wrote:
>> 
>> 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)
>> 
>
>
>
> Isn't that going to cause problems if the configurations clash?
> For example, the scm_storage_prehistory () function that you
> are modifying does
>
> GC_set_all_interior_pointers (0);
>
> If the application that previously initialized the GC relies
> on interior pointer tracing, Guile disabling it is going to
> cause trouble.

Indeed, we would need to agree on these details and come with a
configuration that works with both configurations.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFC,PATCH] Do not GC_INIT the Boehm GC if already initialized
  2023-02-06 18:34 [RFC,PATCH] Do not GC_INIT the Boehm GC if already initialized Jose E. Marchesi
  2023-02-06 20:56 ` Jean Abou Samra
@ 2023-02-07 12:29 ` Maxime Devos
  2023-02-20 10:06   ` Ludovic Courtès
  1 sibling, 1 reply; 7+ messages in thread
From: Maxime Devos @ 2023-02-07 12:29 UTC (permalink / raw)
  To: Jose E. Marchesi, guile-devel; +Cc: ludo


[-- Attachment #1.1.1: Type: text/plain, Size: 1033 bytes --]


 > [RFC,PATCH] Do not GC_INIT the Boehm GC if already initialized
On 06-02-2023 19:34, Jose E. Marchesi wrote:
> 
> 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. > [...]

According to the Boehm GC documentation, this 'conditional 
initialisation' is unnecessary:

/* Portable clients should call this at the program start-up.  More   */
/* over, some platforms require this call to be done strictly from the*/
/* primordial thread.  **Multiple invocations are harmless.**         */
#define GC_INIT() [...]

(emphasis added).

Greetings,
Maxime

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 929 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFC,PATCH] Do not GC_INIT the Boehm GC if already initialized
  2023-02-07 12:29 ` Maxime Devos
@ 2023-02-20 10:06   ` Ludovic Courtès
  2023-02-20 18:01     ` Maxime Devos
  2023-02-20 22:00     ` Hans Åberg
  0 siblings, 2 replies; 7+ messages in thread
From: Ludovic Courtès @ 2023-02-20 10:06 UTC (permalink / raw)
  To: Maxime Devos; +Cc: Jose E. Marchesi, guile-devel

Hi Maxime,

Maxime Devos <maximedevos@telenet.be> skribis:

>> [RFC,PATCH] Do not GC_INIT the Boehm GC if already initialized
> On 06-02-2023 19:34, Jose E. Marchesi wrote:
>> 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. > [...]
>
> According to the Boehm GC documentation, this 'conditional
> initialisation' is unnecessary:
>
> /* Portable clients should call this at the program start-up.  More   */
> /* over, some platforms require this call to be done strictly from the*/
> /* primordial thread.  **Multiple invocations are harmless.**         */
> #define GC_INIT() [...]
>
> (emphasis added).

The “Multiple invocations” bit isn’t in libgc 8.0.4.  Which version are
you looking at?

Thanks,
Ludo’.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFC,PATCH] Do not GC_INIT the Boehm GC if already initialized
  2023-02-20 10:06   ` Ludovic Courtès
@ 2023-02-20 18:01     ` Maxime Devos
  2023-02-20 22:00     ` Hans Åberg
  1 sibling, 0 replies; 7+ messages in thread
From: Maxime Devos @ 2023-02-20 18:01 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: Jose E. Marchesi, guile-devel


[-- Attachment #1.1.1: Type: text/plain, Size: 512 bytes --]



On 20-02-2023 11:06, Ludovic Courtès wrote:
> [...]
> The “Multiple invocations” bit isn’t in libgc 8.0.4.  Which version are
> you looking at?

Commit 151b49a5302eea89ffd9efd9cdb82b75ac4f5d35 (include/gc/gc.h).
Looking at the changelog, that part is there since at least 8.0.6:

[...]
* Refine GC_INIT documentation about its multiple invocation

As it only a documentation change (going by the changelog), possibly the 
same behaviour existed in libgc 8.0.4 too.

Greetings,
Maxime.

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 929 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFC,PATCH] Do not GC_INIT the Boehm GC if already initialized
  2023-02-20 10:06   ` Ludovic Courtès
  2023-02-20 18:01     ` Maxime Devos
@ 2023-02-20 22:00     ` Hans Åberg
  1 sibling, 0 replies; 7+ messages in thread
From: Hans Åberg @ 2023-02-20 22:00 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: Maxime Devos, Jose E. Marchesi, guile-devel


> On 20 Feb 2023, at 11:06, Ludovic Courtès <ludo@gnu.org> wrote:
> 
>> According to the Boehm GC documentation, this 'conditional
>> initialisation' is unnecessary:
>> 
>> /* Portable clients should call this at the program start-up.  More   */
>> /* over, some platforms require this call to be done strictly from the*/
>> /* primordial thread.  **Multiple invocations are harmless.**         */
>> #define GC_INIT() [...]
>> 
>> (emphasis added).
> 
> The “Multiple invocations” bit isn’t in libgc 8.0.4.  Which version are
> you looking at?

It is in MacPorts boehmgc @8.2.2 (devel), which Guile lists as a dependency.





^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-02-20 22:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-06 18:34 [RFC,PATCH] Do not GC_INIT the Boehm GC if already initialized Jose E. Marchesi
2023-02-06 20:56 ` Jean Abou Samra
2023-02-06 21:05   ` Jose E. Marchesi
2023-02-07 12:29 ` Maxime Devos
2023-02-20 10:06   ` Ludovic Courtès
2023-02-20 18:01     ` Maxime Devos
2023-02-20 22:00     ` Hans Åberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).