1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-07-07 18:10:21 +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

@ -817,7 +817,7 @@ make_cif (SCM return_type, SCM arg_types, const char *caller)
cif_len = (ROUND_UP (cif_len, alignof_type (ffi_type))
+ (nargs + n_struct_elts + 1)*sizeof(ffi_type));
mem = scm_allocate_pointerless (SCM_I_CURRENT_THREAD, cif_len);
mem = scm_allocate_untagged_pointerless (SCM_I_CURRENT_THREAD, cif_len);
/* ensure all the memory is initialized, even the holes */
memset (mem, 0, cif_len);
cif = (ffi_cif *) mem;
@ -1133,7 +1133,8 @@ pack (const ffi_type * type, const void *loc, int return_value_p)
case FFI_TYPE_STRUCT:
{
void *mem = scm_allocate_pointerless (SCM_I_CURRENT_THREAD, type->size);
void *mem =
scm_allocate_untagged_pointerless (SCM_I_CURRENT_THREAD, type->size);
memcpy (mem, loc, type->size);
return scm_from_pointer (mem, NULL);
}