This is an automated email from the git hooks/post-receive script.

wingo pushed a commit to branch wip-whippet
in repository guile.

The following commit(s) were added to refs/heads/wip-whippet by this push:
     new 718c914e7 Fix evacuation of bytevectors with inline storage
718c914e7 is described below

commit 718c914e7b1f251f7e348f713eb92e1c42a8bc7f
Author: Andy Wingo <wi...@pobox.com>
AuthorDate: Fri Jul 4 09:24:05 2025 +0200

    Fix evacuation of bytevectors with inline storage
    
    * libguile/bytevectors.c (make_bytevector): We were allocating these as
    tagged pointerless, which means that the trace function wasn't being
    called; whereas, it was necessary in the case of a relocation.  Instead,
    allocate tagged if the collector supports object motion.
---
 libguile/bytevectors.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/libguile/bytevectors.c b/libguile/bytevectors.c
index 616f200ac..f103fe73e 100644
--- a/libguile/bytevectors.c
+++ b/libguile/bytevectors.c
@@ -41,6 +41,8 @@
 #include <gmp.h>
 #endif
 
+#include "gc-attrs.h"
+
 #include "array-handle.h"
 #include "arrays.h"
 #include "boolean.h"
@@ -232,9 +234,11 @@ make_bytevector (size_t len, scm_t_array_element_type 
element_type)
     return null_bytevector;
 
   size_t c_len = len * bytes_per_elt;
-  struct scm_bytevector *bv =
-    scm_allocate_tagged_pointerless (SCM_I_CURRENT_THREAD,
-                                     sizeof (struct scm_bytevector) + c_len);
+  struct scm_bytevector *bv = gc_can_move_objects()
+    ? scm_allocate_tagged (SCM_I_CURRENT_THREAD,
+                           sizeof (struct scm_bytevector) + c_len)
+    : scm_allocate_tagged_pointerless (SCM_I_CURRENT_THREAD,
+                                       sizeof (struct scm_bytevector) + c_len);
 
   scm_t_bits flags = SCM_F_BYTEVECTOR_CONTIGUOUS;
   bv->tag_flags_and_element_type = make_bytevector_tag (flags, element_type);

Reply via email to