diff --git a/libguile/trace.h b/libguile/trace.h index eb35f4985..99cefbd76 100644 --- a/libguile/trace.h +++ b/libguile/trace.h @@ -434,8 +434,12 @@ scm_trace_vm_cont (struct scm_vm_cont *c, TRACE_PARAMS) static inline size_t scm_trace_bytevector (struct scm_bytevector *x, TRACE_PARAMS) { - if (x->contents == x->inline_contents) - return SIZEOF_WITH_TAIL (x, inline_contents, x->length); + if (scm_bytevector_is_contiguous (x)) + { + // Update internal pointer after a move, if needed. + x->contents = x->inline_contents; + return SIZEOF_WITH_TAIL (x, inline_contents, x->length); + } if (trace) { diff --git a/module/system/vm/assembler.scm b/module/system/vm/assembler.scm index 2ec0c0e4b..8369b33a7 100644 --- a/module/system/vm/assembler.scm +++ b/module/system/vm/assembler.scm @@ -1869,6 +1869,7 @@ should be .data or .rodata), and return the resulting linker object. (define tc7-bytevector #x4d) (define bytevector-immutable-flag #x80) + (define bytevector-contiguous-flag #x100) (define tc7-array #x5d) @@ -2056,6 +2057,7 @@ should be .data or .rodata), and return the resulting linker object. ((simple-uniform-vector? obj) (let ((tag (logior tc7-bytevector bytevector-immutable-flag + bytevector-contiguous-flag (ash (array-type-code obj) 16)))) (case word-size ((4)