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

Add support for C16_C16 instruction words

* module/language/bytecode.scm (compute-instruction-arity):
* module/system/vm/assembler.scm (pack-u16-u16, expand):
* module/system/vm/disassembler.scm (disassembler):
* libguile/instructions.c (FOR_EACH_INSTRUCTION_WORD_TYPE): Add C16_C16.
This commit is contained in:
Andy Wingo 2017-10-24 21:11:20 +02:00
parent 214e887dbd
commit 808000034e
4 changed files with 18 additions and 5 deletions

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2001, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc. /* Copyright (C) 2001, 2009, 2010, 2011, 2012, 2013, 2017 Free Software Foundation, Inc.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License * modify it under the terms of the GNU Lesser General Public License
@ -65,7 +65,8 @@ SCM_SYMBOL (sym_bang, "!");
M(B1_X7_C24) \ M(B1_X7_C24) \
M(B1_X7_S24) \ M(B1_X7_S24) \
M(B1_X7_F24) \ M(B1_X7_F24) \
M(B1_X31) M(B1_X31) \
M(C16_C16)
#define TYPE_WIDTH 6 #define TYPE_WIDTH 6

View file

@ -1,6 +1,6 @@
;;; Bytecode ;;; Bytecode
;; Copyright (C) 2013 Free Software Foundation, Inc. ;; Copyright (C) 2013, 2017 Free Software Foundation, Inc.
;;;; This library is free software; you can redistribute it and/or ;;;; This library is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU Lesser General Public ;;;; modify it under the terms of the GNU Lesser General Public
@ -58,6 +58,7 @@
((L32) 1) ((L32) 1)
((LO32) 1) ((LO32) 1)
((C8_C24) 2) ((C8_C24) 2)
((C16_C16) 2)
((B1_C7_L24) 3) ((B1_C7_L24) 3)
((B1_X7_S24) 2) ((B1_X7_S24) 2)
((B1_X7_F24) 2) ((B1_X7_F24) 2)

View file

@ -1,6 +1,6 @@
;;; Guile bytecode assembler ;;; Guile bytecode assembler
;;; Copyright (C) 2001, 2009, 2010, 2012, 2013, 2014, 2015 Free Software Foundation, Inc. ;;; Copyright (C) 2001, 2009, 2010, 2012, 2013, 2014, 2015, 2017 Free Software Foundation, Inc.
;;; ;;;
;;; This library is free software; you can redistribute it and/or ;;; This library is free software; you can redistribute it and/or
;;; modify it under the terms of the GNU Lesser General Public ;;; modify it under the terms of the GNU Lesser General Public
@ -278,6 +278,11 @@
(y (check-srange y #xffffff))) (y (check-srange y #xffffff)))
(logior x (ash y 8)))) (logior x (ash y 8))))
(define-inline (pack-u16-u16 x y)
(let ((x (check-urange x #xffff))
(y (check-urange y #xffff)))
(logior x (ash y 16))))
(define-inline (pack-u1-u7-u24 x y z) (define-inline (pack-u1-u7-u24 x y z)
(let ((x (check-urange x #x1)) (let ((x (check-urange x #x1))
(y (check-urange y #x7f)) (y (check-urange y #x7f))
@ -621,6 +626,8 @@ later by the linker."
(emit asm 0)) (emit asm 0))
((C8_C24 a b) ((C8_C24 a b)
(emit asm (pack-u8-u24 a b))) (emit asm (pack-u8-u24 a b)))
((C16_C16 a b)
(emit asm (pack-u16-u16 a b)))
((B1_X7_L24 a label) ((B1_X7_L24 a label)
(record-label-reference asm label) (record-label-reference asm label)
(emit asm (pack-u1-u7-u24 (if a 1 0) 0 0))) (emit asm (pack-u1-u7-u24 (if a 1 0) 0 0)))
@ -852,6 +859,7 @@ later by the linker."
('L32 #'(label)) ('L32 #'(label))
('LO32 #'(label offset)) ('LO32 #'(label offset))
('C8_C24 #'(a b)) ('C8_C24 #'(a b))
('C16_C16 #'(a b))
('B1_X7_L24 #'(a label)) ('B1_X7_L24 #'(a label))
('B1_C7_L24 #'(a b label)) ('B1_C7_L24 #'(a b label))
('B1_X31 #'(a)) ('B1_X31 #'(a))

View file

@ -1,6 +1,6 @@
;;; Guile bytecode disassembler ;;; Guile bytecode disassembler
;;; Copyright (C) 2001, 2009, 2010, 2012, 2013, 2014, 2015 Free Software Foundation, Inc. ;;; Copyright (C) 2001, 2009, 2010, 2012, 2013, 2014, 2015, 2017 Free Software Foundation, Inc.
;;; ;;;
;;; This library is free software; you can redistribute it and/or ;;; This library is free software; you can redistribute it and/or
;;; modify it under the terms of the GNU Lesser General Public ;;; modify it under the terms of the GNU Lesser General Public
@ -115,6 +115,9 @@
((C8_C24) ((C8_C24)
#'((logand word #xff) #'((logand word #xff)
(ash word -8))) (ash word -8)))
((C16_C16)
#'((logand word #xffff)
(ash word -16)))
((B1_C7_L24) ((B1_C7_L24)
#'((not (zero? (logand word #x1))) #'((not (zero? (logand word #x1)))
(logand (ash word -1) #x7f) (logand (ash word -1) #x7f)