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

@ -199,7 +199,8 @@ make_narrow_stringbuf (size_t len)
return (struct scm_narrow_stringbuf *) &null_stringbuf;
struct scm_narrow_stringbuf *buf =
scm_allocate_pointerless (SCM_I_CURRENT_THREAD, sizeof (*buf) + len + 1);
scm_allocate_tagged_pointerless (SCM_I_CURRENT_THREAD,
sizeof (*buf) + len + 1);
buf->header.tag_and_flags = scm_tc7_stringbuf;
buf->header.length = len;
@ -222,8 +223,9 @@ make_wide_stringbuf (size_t len)
scm_out_of_range ("make_stringbuf", scm_from_size_t (len));
struct scm_wide_stringbuf *buf =
scm_allocate_pointerless (SCM_I_CURRENT_THREAD,
sizeof (*buf) + (len + 1) * sizeof (scm_t_wchar));
scm_allocate_tagged_pointerless (SCM_I_CURRENT_THREAD,
sizeof (*buf)
+ (len + 1) * sizeof (scm_t_wchar));
buf->header.tag_and_flags = scm_tc7_stringbuf | SCM_I_STRINGBUF_F_WIDE;
buf->header.length = len;
@ -1513,7 +1515,7 @@ decoding_error (const char *func_name, int errno_save,
SCM bv;
signed char *buf;
buf = scm_allocate_pointerless (SCM_I_CURRENT_THREAD, len);
buf = scm_allocate_untagged_pointerless (SCM_I_CURRENT_THREAD, len);
memcpy (buf, str, len);
bv = scm_c_take_gc_bytevector (buf, len, SCM_BOOL_F);