mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-10 22:10:21 +02:00
Rework treatment of bytevector flags
Before, they were always shifted by 7. Now the flags are just above 0x7f and just the element type is shifted, but by 16. * libguile/bytevectors.h (SCM_BYTEVECTOR_FLAGS): Rework to not shift. (SCM_SET_BYTEVECTOR_FLAGS): Remove. (SCM_MUTABLE_BYTEVECTOR_P): Don't shift the immutable flag. (SCM_BYTEVECTOR_ELEMENT_TYPE): Shift right by 16. * libguile/bytevectors.c (SCM_BYTEVECTOR_SET_FLAG): Remove unused helper. (make_bytevector_tag): New helper. (make_bytevector): Use new helper. (make_bytevector_from_buffer): Add flags and parent args, and use new helper. (scm_c_take_gc_bytevector): (scm_c_take_typed_bytevector): (scm_bytevector_slice): Update callers. * module/system/vm/assembler.scm (link-data): Don't shift the flag by 7; instead shift the element type by 16.
This commit is contained in:
parent
464ec999de
commit
043a5b62bb
3 changed files with 28 additions and 49 deletions
|
@ -1864,7 +1864,6 @@ should be .data or .rodata), and return the resulting linker object.
|
|||
(define tc7-program #x45)
|
||||
|
||||
(define tc7-bytevector #x4d)
|
||||
;; This flag is intended to be left-shifted by 7 bits.
|
||||
(define bytevector-immutable-flag #x200)
|
||||
|
||||
(define tc7-array #x5d)
|
||||
|
@ -2029,11 +2028,8 @@ should be .data or .rodata), and return the resulting linker object.
|
|||
(logior tc7-bitvector
|
||||
bitvector-immutable-flag)
|
||||
(logior tc7-bytevector
|
||||
;; Bytevector immutable flag also shifted
|
||||
;; left.
|
||||
(ash (logior bytevector-immutable-flag
|
||||
(array-type-code obj))
|
||||
7)))))
|
||||
bytevector-immutable-flag
|
||||
(ash (array-type-code obj) 16)))))
|
||||
(case word-size
|
||||
((4)
|
||||
(bytevector-u32-set! buf pos tag endianness)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue