lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GC and simple smobs??


From: David Kastrup
Subject: Re: GC and simple smobs??
Date: Tue, 21 Jun 2022 13:21:27 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Jean Abou Samra <jean@abou-samra.fr> writes:

> To check that, I applied
>
> diff --git a/lily/duration-scheme.cc b/lily/duration-scheme.cc
> index 5d9b4447f1..6a09253adf 100644
> --- a/lily/duration-scheme.cc
> +++ b/lily/duration-scheme.cc
> @@ -45,6 +45,8 @@ Is @var{p1} shorter than @var{p2}?
>    auto *const a = LY_ASSERT_SMOB (Duration, p1, 1);
>    auto *const b = LY_ASSERT_SMOB (Duration, p2, 2);
>
> +  scm_gc ();
> +
>    if (Duration::compare (*a, *b) < 0)
>      return SCM_BOOL_T;
>    else
>
> and compiled
>
> #(do ((i 0 (1+ i)))
>    ((= i 100))
>    (ly:duration<? #{ 4 #} #{ 8 #}))
>
>
> No crashes observed.

That tells you nothing at all unless you verify that the generated code
writes over p1 and p2 before scm_gc is called.  This is possible due to
optimisation but unlikely.

> If I am understanding this correctly, a source of possible GC
> crashes went away in the Guile 2 transition. Or am I missing
> something?

The Guile API does not give any guarantees as far as I can see, but I
would not rule out that the current implementation dereferences SCM
pointers as pointers.  I have no idea about the internal representation
of SCM types at the moment, nor whether there may be different ones
depending on platforms and/or options.

-- 
David Kastrup



reply via email to

[Prev in Thread] Current Thread [Next in Thread]