mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-07-02 23:50:47 +02:00
Change to not inline scm_cell / scm_double_cell / scm_words
* libguile/gc-malloc.c (scm_cell): (scm_double_cell): (scm_words): Implement here. * libguile/gc.h: * libguile/inline.c: Not here.
This commit is contained in:
parent
4bb5fc526b
commit
8141c35ec4
3 changed files with 54 additions and 97 deletions
|
@ -207,3 +207,53 @@ scm_gc_strdup (const char *str, const char *what)
|
|||
{
|
||||
return scm_gc_strndup (str, strlen (str), what);
|
||||
}
|
||||
|
||||
SCM
|
||||
scm_cell (scm_t_bits car, scm_t_bits cdr)
|
||||
{
|
||||
scm_t_bits *words = scm_allocate_sloppy (SCM_I_CURRENT_THREAD,
|
||||
sizeof (scm_t_bits) * 2);
|
||||
|
||||
words[0] = car;
|
||||
words[1] = cdr;
|
||||
|
||||
/* Probably the user isn't accessing the object as a "scm_t_bits*", and
|
||||
in standard C that would allow the compiler to treat the above
|
||||
writes as not aliasing the "struct scm_pair" or whatever that the
|
||||
user actually wants, which can result in correctness-breaking
|
||||
optimizations. Therefore Guile compiles with -fno-strict-aliasing,
|
||||
and doesn't expose this function for inlining. It would be nice if
|
||||
Guile could be written in fully standard C, but that's not where
|
||||
we're at right now. */
|
||||
|
||||
return SCM_PACK_POINTER (words);
|
||||
}
|
||||
|
||||
SCM
|
||||
scm_double_cell (scm_t_bits car, scm_t_bits cbr,
|
||||
scm_t_bits ccr, scm_t_bits cdr)
|
||||
{
|
||||
scm_t_bits *words = scm_allocate_sloppy (SCM_I_CURRENT_THREAD,
|
||||
sizeof (scm_t_bits) * 4);
|
||||
|
||||
words[0] = car;
|
||||
words[1] = cbr;
|
||||
words[2] = ccr;
|
||||
words[3] = cdr;
|
||||
|
||||
/* See above notes about strict aliasing. */
|
||||
|
||||
return SCM_PACK_POINTER (words);
|
||||
}
|
||||
|
||||
SCM
|
||||
scm_words (scm_t_bits car, uint32_t n_words)
|
||||
{
|
||||
scm_t_bits *words = scm_allocate_sloppy (SCM_I_CURRENT_THREAD,
|
||||
sizeof (scm_t_bits) * n_words);
|
||||
words[0] = car;
|
||||
|
||||
/* See above notes about strict aliasing. */
|
||||
|
||||
return SCM_PACK_POINTER (words);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue