From cbfed0be5a1ef9dc723ce3d08b511182fdab51a7 Mon Sep 17 00:00:00 2001 From: Juho Snellman Date: Thu, 10 Feb 2005 00:05:56 +0000 Subject: [PATCH] 0.8.19.21: x86-64 disassembler improvements. * Detect RIP-relative addressing in SB-VM::PREFILTER-REG/MEM. * Add constant notes (e.g. ; #) for instructions that use RIP-relative addressing. --- src/compiler/x86-64/insts.lisp | 2 +- src/compiler/x86-64/target-insts.lisp | 39 +++++++++++++++++++++++---------- version.lisp-expr | 2 +- 3 files changed, 29 insertions(+), 14 deletions(-) diff --git a/src/compiler/x86-64/insts.lisp b/src/compiler/x86-64/insts.lisp index 86c1c0e..2abd0ea 100644 --- a/src/compiler/x86-64/insts.lisp +++ b/src/compiler/x86-64/insts.lisp @@ -215,7 +215,7 @@ (if (= index-reg #b100) nil index-reg) (ash 1 index-scale)))))) ((and (= mod #b00) (= r/m #b101)) - (list nil (sb!disassem:read-signed-suffix 32 dstate)) ) + (list 'rip (sb!disassem:read-signed-suffix 32 dstate)) ) ((= mod #b00) (list full-reg)) ((= mod #b01) diff --git a/src/compiler/x86-64/target-insts.lisp b/src/compiler/x86-64/target-insts.lisp index c021af1..aef6243 100644 --- a/src/compiler/x86-64/target-insts.lisp +++ b/src/compiler/x86-64/target-insts.lisp @@ -24,7 +24,7 @@ (princ (sb!disassem:dstate-get-prop dstate 'width) stream) (princ '| PTR | stream)) (write-char #\[ stream) - (let ((firstp t)) + (let ((firstp t) (rip-p nil)) (macrolet ((pel ((var val) &body body) ;; Print an element of the address, maybe with ;; a leading separator. @@ -35,7 +35,11 @@ ,@body (setq firstp nil))))) (pel (base-reg (first value)) - (print-addr-reg base-reg stream dstate)) + (cond ((eql 'rip base-reg) + (setf rip-p t) + (princ base-reg stream)) + (t + (print-addr-reg base-reg stream dstate)))) (pel (index-reg (third value)) (print-addr-reg index-reg stream dstate) (let ((index-scale (fourth value))) @@ -46,14 +50,25 @@ (when (and offset (or firstp (not (zerop offset)))) (unless (or firstp (minusp offset)) (write-char #\+ stream)) - (if firstp - (progn - (sb!disassem:princ16 offset stream) - (or (minusp offset) - (nth-value 1 - (sb!disassem::note-code-constant-absolute offset dstate)) - (sb!disassem:maybe-note-assembler-routine offset - nil - dstate))) - (princ offset stream)))))) + (cond + (rip-p + (princ offset stream) + (let ((addr (+ offset (sb!disassem:dstate-next-addr dstate)))) + (or (nth-value 1 + (sb!disassem::note-code-constant-absolute + addr dstate)) + (sb!disassem:maybe-note-assembler-routine addr + nil + dstate)))) + (firstp + (progn + (sb!disassem:princ16 offset stream) + (or (minusp offset) + (nth-value 1 + (sb!disassem::note-code-constant-absolute offset dstate)) + (sb!disassem:maybe-note-assembler-routine offset + nil + dstate)))) + (t + (princ offset stream))))))) (write-char #\] stream)) diff --git a/version.lisp-expr b/version.lisp-expr index 2a83eac..bbb042e 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -17,4 +17,4 @@ ;;; checkins which aren't released. (And occasionally for internal ;;; versions, especially for internal versions off the main CVS ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"0.8.19.20" +"0.8.19.21" -- 1.7.10.4