lilypond-devel
[Top][All Lists]
Advanced

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

Re: Likely a good frog project for someone with C knowledge


From: David Kastrup
Subject: Re: Likely a good frog project for someone with C knowledge
Date: Tue, 16 Aug 2011 23:59:33 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

Reinhold Kainhofer <address@hidden> writes:

> Am Tuesday, 16. August 2011, 23:36:15 schrieb Reinhold Kainhofer:
>> However, I'm not sure if this will really work out or give us much benefit.
>> In particular, we have lots of checks for == SCM_EOL or == SCM_BOOL_T. E.g.
>> very deep inside the core of lilypond:
>> 
>> inline bool ly_cheap_is_list (SCM x) {return scm_is_pair (x) || x==SCM_EOL;
>> }
>
> Most of the errors will come from the implementation of ly_symbol2scm 
> (lily/include/lily-guile-macros.hh):
>
> #ifdef CACHE_SYMBOLS
> [...]
> /* Using this trick we cache the value of scm_from_locale_symbol ("fooo") 
> where
>    "fooo" is a constant string. This is done at the cost of one static
>    variable per ly_symbol2scm() use, and one boolean evaluation for
>    every call.
>  */
> #define ly_symbol2scm(x)                                                \
>   ({                                                                    \
>     static SCM cached;                                                  \
>     /* We store this one locally, since G++ -O2 fucks up else */        \
>     SCM value = cached;                                                 \
>     if (__builtin_constant_p ((x)))                                     \
>       {                                                                 \
>         if (!cached)                                                    \
>           value = cached = scm_gc_protect_object (scm_or_str2symbol (x)); \
>       }                                                                 \
>     else                                                                \
>       value = scm_or_str2symbol (x);                                    \
>     value;                                                              \
>   })
> #else
>
>
> The "problem" is the !cached, which was added by Han-Wen in version 1.5.19 in 
> commit 6c00542bf11cd4759b2e39537aeb3d9a533a3519 in October 2001 (before it 
> was 
> also there as a check "(cached)?cached:scm_..."). 

 -- C Macro: scm_t_bits SCM_UNPACK (SCM X)
     Transforms the `SCM' value X into its representation as an
     integral type.  Only after applying `SCM_UNPACK' it is possible to
     access the bits and contents of the `SCM' value.

-- 
David Kastrup




reply via email to

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