diff options
author | Andy Wingo <wingo@pobox.com> | 2020-07-30 17:36:11 +0200 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2020-07-30 17:36:11 +0200 |
commit | 172e5ccfc1e0a26880fd328ef72c7bbcb9c2fca1 (patch) | |
tree | a495dbbb5fdd3f58a9f3eef081a058daac91d14c /module/system/vm/disassembler.scm | |
parent | f13b27a4cc6ea35e8595e7d926c5632eb797364a (diff) | |
download | guile-172e5ccfc1e0a26880fd328ef72c7bbcb9c2fca1.tar.gz |
Add sign-extending make-immediate instruction
* doc/ref/vm.texi (Instruction Set, Constant Instructions): Document new
instruction.
* libguile/instructions.c (FOR_EACH_INSTRUCTION_WORD_TYPE): New first
word kind with zi16 operand.
* libguile/jit.c (compile_make_immediate, compile_make_immediate_slow):
New compilers.
(COMPILE_X8_S8_ZI16): New operand kind.
* libguile/vm-engine.c (make-immediate): New instruction.
* module/language/bytecode.scm:
* module/system/vm/assembler.scm (encode-X8_S8_ZI16<-/shuffle):
(signed-bits, load-constant): Support the new instruction kind.
* module/system/vm/disassembler.scm (disassemblers)
(sign-extended-immediate, code-annotation): Support for zi16
operands.
Diffstat (limited to 'module/system/vm/disassembler.scm')
-rw-r--r-- | module/system/vm/disassembler.scm | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/module/system/vm/disassembler.scm b/module/system/vm/disassembler.scm index d51c14d23..1cb767093 100644 --- a/module/system/vm/disassembler.scm +++ b/module/system/vm/disassembler.scm @@ -95,7 +95,7 @@ #'((ash word -8))) ((X8_L24) #'((unpack-s24 (ash word -8)))) - ((X8_S8_I16) + ((X8_S8_I16 X8_S8_ZI16) #'((logand (ash word -8) #xff) (ash word -16))) ((X8_S12_S12 @@ -205,6 +205,14 @@ address of that offset." (visit-heap-tags define-heap-tag-annotation) +(define (sign-extended-immediate uimm n) + (unpack-scm + (if (>= uimm (ash 1 (- n 1))) + (let ((word-bits (* (sizeof '*) 8))) ; FIXME + (logand (1- (ash 1 word-bits)) + (- uimm (ash 1 n)))) + uimm))) + (define (code-annotation code len offset start labels context push-addr!) ;; FIXME: Print names for register loads and stores that correspond to ;; access to named locals. @@ -227,6 +235,8 @@ address of that offset." (('prompt tag escape-only? proc-slot handler) ;; The H is for handler. (list "H -> ~A" (vector-ref labels (- (+ offset handler) start)))) + (('make-immediate _ imm) + (list "~S" (sign-extended-immediate imm 16))) (((or 'make-short-immediate 'make-long-immediate) _ imm) (list "~S" (unpack-scm imm))) (('make-long-long-immediate _ high low) |