1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-07-07 01:50:32 +02:00

Separate tagged and untagged pointerless allocations

Tagged allocations can move; untagged allocations cannot.

* libguile/gc-inline.h:
* libguile/gc-malloc.c:
* libguile/gc.h: Split scm_allocate_pointerless into tagged and untagged
variants.
* libguile/bitvectors.c:
* libguile/bytevectors.c:
* libguile/foreign.c:
* libguile/fports.c:
* libguile/integers.c:
* libguile/intrinsics.c:
* libguile/load.c:
* libguile/loader.c:
* libguile/numbers.c:
* libguile/programs.h:
* libguile/random.c:
* libguile/read.c:
* libguile/regex-posix.c:
* libguile/smob.c:
* libguile/strings.c:
* libguile/vm.c: Use the new functions.
This commit is contained in:
Andy Wingo 2025-07-03 10:10:20 +02:00
parent e21aa9c513
commit 8623e252bf
19 changed files with 85 additions and 72 deletions

View file

@ -422,15 +422,13 @@ scm_i_fraction2double (SCM z)
static SCM
scm_i_from_double (double val)
{
SCM z;
struct scm_t_double *z =
scm_allocate_tagged_pointerless (SCM_I_CURRENT_THREAD, sizeof (*z));
z = SCM_PACK_POINTER
(scm_allocate_pointerless (SCM_I_CURRENT_THREAD, sizeof (scm_t_double)));
z->type = scm_tc16_real;
z->real = val;
SCM_SET_CELL_TYPE (z, scm_tc16_real);
SCM_REAL_VALUE (z) = val;
return z;
return SCM_PACK_POINTER (z);
}
SCM_PRIMITIVE_GENERIC (scm_exact_p, "exact?", 1, 0, 0,
@ -6074,14 +6072,12 @@ SCM_PRIMITIVE_GENERIC (scm_sys_atanh, "atanh", 1, 0, 0,
SCM
scm_c_make_rectangular (double re, double im)
{
SCM z;
z = SCM_PACK_POINTER
(scm_allocate_pointerless (SCM_I_CURRENT_THREAD, sizeof (scm_t_complex)));
SCM_SET_CELL_TYPE (z, scm_tc16_complex);
SCM_COMPLEX_REAL (z) = re;
SCM_COMPLEX_IMAG (z) = im;
return z;
struct scm_t_complex *z =
scm_allocate_tagged_pointerless (SCM_I_CURRENT_THREAD, sizeof (*z));
z->type = scm_tc16_complex;
z->real = re;
z->imag = im;
return SCM_PACK_POINTER (z);
}
SCM_DEFINE (scm_make_rectangular, "make-rectangular", 2, 0, 0,