1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 11:50:28 +02:00

VM opcodes only have <24-bit slot operands in the first word

* libguile/vm-engine.c (make-array): Change to only have
  restricted-width operands in the first word.  This instruction is
  currently unused, however.

* module/system/vm/assembler.scm (assembler):
* module/system/vm/disassembler.scm (disassembler): Disallow
  restricted-width operands in tail words.
This commit is contained in:
Andy Wingo 2014-04-20 11:52:14 +02:00
parent d6651f6903
commit c09708f985
3 changed files with 5 additions and 29 deletions

View file

@ -2783,15 +2783,15 @@ VM_NAME (scm_i_thread *thread, struct scm_vm *vp,
NEXT (3); NEXT (3);
} }
/* make-array dst:12 type:12 _:8 fill:12 bounds:12 /* make-array dst:8 type:8 fill:8 _:8 bounds:24
* *
* Make a new array with TYPE, FILL, and BOUNDS, storing it in DST. * Make a new array with TYPE, FILL, and BOUNDS, storing it in DST.
*/ */
VM_DEFINE_OP (106, make_array, "make-array", OP2 (U8_U12_U12, X8_U12_U12) | OP_DST) VM_DEFINE_OP (106, make_array, "make-array", OP2 (U8_U8_U8_U8, X8_U24) | OP_DST)
{ {
scm_t_uint16 dst, type, fill, bounds; scm_t_uint8 dst, type, fill, bounds;
UNPACK_12_12 (op, dst, type); UNPACK_8_8_8 (op, dst, type, fill);
UNPACK_12_12 (ip[1], fill, bounds); UNPACK_24 (ip[1], bounds);
SYNC_IP (); SYNC_IP ();
LOCAL_SET (dst, scm_make_typed_array (LOCAL_REF (type), LOCAL_REF (fill), LOCAL_SET (dst, scm_make_typed_array (LOCAL_REF (type), LOCAL_REF (fill),
LOCAL_REF (bounds))); LOCAL_REF (bounds)));

View file

@ -398,12 +398,6 @@ later by the linker."
((U8_L24 a label) ((U8_L24 a label)
(record-label-reference asm label) (record-label-reference asm label)
(emit asm a)) (emit asm a))
((U8_U8_I16 a b imm)
(emit asm (pack-u8-u8-u16 a b (object-address imm))))
((U8_U12_U12 a b)
(emit asm (pack-u8-u12-u12 a b c)))
((U8_U8_U8_U8 a b c d)
(emit asm (pack-u8-u8-u8-u8 a b c d)))
((U32 a) ((U32 a)
(emit asm a)) (emit asm a))
((I32 imm) ((I32 imm)
@ -432,8 +426,6 @@ later by the linker."
(emit asm 0)) (emit asm 0))
((X8_U24 a) ((X8_U24 a)
(emit asm (pack-u8-u24 0 a))) (emit asm (pack-u8-u24 0 a)))
((X8_U12_U12 a b)
(emit asm (pack-u8-u12-u12 0 a b)))
((X8_L24 label) ((X8_L24 label)
(record-label-reference asm label) (record-label-reference asm label)
(emit asm 0)) (emit asm 0))

View file

@ -110,19 +110,6 @@
((U8_L24) ((U8_L24)
#'((logand word #xff) #'((logand word #xff)
(unpack-s24 (ash word -8)))) (unpack-s24 (ash word -8))))
((U8_U8_I16)
#'((logand word #xff)
(logand (ash word -8) #xff)
(ash word -16)))
((U8_U12_U12)
#'((logand word #xff)
(logand (ash word -8) #xfff)
(ash word -20)))
((U8_U8_U8_U8)
#'((logand word #xff)
(logand (ash word -8) #xff)
(logand (ash word -16) #xff)
(ash word -24)))
((U32) ((U32)
#'(word)) #'(word))
((I32) ((I32)
@ -141,9 +128,6 @@
#'((unpack-s32 word))) #'((unpack-s32 word)))
((X8_U24) ((X8_U24)
#'((ash word -8))) #'((ash word -8)))
((X8_U12_U12)
#'((logand (ash word -8) #xfff)
(ash word -20)))
((X8_L24) ((X8_L24)
#'((unpack-s24 (ash word -8)))) #'((unpack-s24 (ash word -8))))
((B1_X7_L24) ((B1_X7_L24)