master: Show raw constants of :DWORD or :QWORD size

snuglas via Sbcl-commits <[email protected]>
Newsgroups gmane.lisp.steel-bank.cvs
Message-ID <[email protected]>
The branch "master" has been updated in SBCL:
       via  5c06950e50aab8fecd3821112309629655d9e329 (commit)
      from  828810aa336a4df55433fc26c54651c87d463ac7 (commit)

- Log -----------------------------------------------------------------
commit 5c06950e50aab8fecd3821112309629655d9e329
Author: Douglas Katzman <[email protected]>
Date:   Sat Apr 18 21:44:54 2026 -0400

    Show raw constants of :DWORD or :QWORD size
    
    For instructions like MUL that can't take an immediate, it is helpful
    with "MUL DWORD [RIP-n]" to not have to guess what the operand is.
---
 src/compiler/x86-64/target-insts.lisp | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/compiler/x86-64/target-insts.lisp b/src/compiler/x86-64/target-insts.lisp
index 89f6e2cb6..f1d7edb1c 100644
--- a/src/compiler/x86-64/target-insts.lisp
+++ b/src/compiler/x86-64/target-insts.lisp
@@ -378,11 +378,13 @@
 
 ;;; Return contents of memory if either it refers to an unboxed code constant
 ;;; or is RIP-relative with a displacement of 0.
-(defun unboxed-constant-ref (dstate addr disp)
+(defun unboxed-constant-ref (dstate addr disp width)
   (when (and (minusp disp)
              (awhen (seg-code (dstate-segment dstate))
                (sb-disassem::points-to-code-constant-p addr it)))
-    (sap-ref-word (int-sap addr) 0)))
+    (ecase width
+      (:qword (sap-ref-word (int-sap addr) 0))
+      (:dword (sap-ref-32 (int-sap addr) 0)))))
 
 (define-load-time-global thread-slot-names
     (let* ((slots (coerce (primitive-object-slots
@@ -497,9 +499,7 @@
                  (maybe-note-assembler-routine addr nil dstate))
                ;; Show the absolute address and maybe the contents.
                (note (format nil "[#x~x]~@[ = #x~x~]"
-                             addr
-                             (case width
-                              (:qword (unboxed-constant-ref dstate addr disp))))
+                             addr (unboxed-constant-ref dstate addr disp width))
                      dstate))))))
 
     ;; Recognize [R12-disp] as a linkage table use (lisp or alien)

-----------------------------------------------------------------------


hooks/post-receive
-- 
SBCL
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.