1.0.4.44: More x86 disassembler work
[sbcl.git] / src / compiler / target-disassem.lisp
index 805c1c6..b34a6a1 100644 (file)
 
 (defun fun-self (fun)
   (declare (type compiled-function fun))
-  (sb!kernel:%simple-fun-self fun))
+  (sb!kernel:%simple-fun-self (sb!kernel:%fun-fun fun)))
 
 (defun fun-code (fun)
   (declare (type compiled-function fun))
 
 (defun fun-next (fun)
   (declare (type compiled-function fun))
-  (sb!kernel:%simple-fun-next fun))
+  (sb!kernel:%simple-fun-next (sb!kernel:%fun-fun fun)))
 
 (defun fun-address (fun)
   (declare (type compiled-function fun))
-  (ecase (sb!kernel:widetag-of fun)
-    (#.sb!vm:simple-fun-header-widetag
-     (- (sb!kernel:get-lisp-obj-address fun) sb!vm:fun-pointer-lowtag))
-    (#.sb!vm:closure-header-widetag
-     (fun-address (sb!kernel:%closure-fun fun)))
-    (#.sb!vm:funcallable-instance-header-widetag
-     (fun-address (sb!kernel:funcallable-instance-fun fun)))))
+  (- (sb!kernel:get-lisp-obj-address (sb!kernel:%fun-fun fun)) sb!vm:fun-pointer-lowtag))
 
 ;;; the offset of FUNCTION from the start of its code-component's
 ;;; instruction area
            (type (or null stream) stream))
 
   (let ((ispace (get-inst-space))
-        (prefix-p nil)) ; just processed a prefix inst
+        (prefix-p nil) ; just processed a prefix inst
+        (prefix-len 0)) ; length of any prefix instruction(s)
 
     (rewind-current-segment dstate segment)
 
                             (when prefilter
                               (funcall prefilter chunk dstate))
 
+                            (setf prefix-p (null (inst-printer inst)))
+
                             ;; print any instruction bytes recognized by the prefilter which calls read-suffix
                             ;; and updates next-offs
                             (when stream
                               (let ((suffix-len (- (dstate-next-offs dstate) orig-next)))
                                 (when (plusp suffix-len)
                                   (print-inst suffix-len stream dstate :offset (inst-length inst) :trailing-space nil))
-                              (dotimes (i (- *disassem-inst-column-width* (* 2 (+ (inst-length inst) suffix-len))))
-                                (write-char #\space stream)))
-                              (write-char #\space stream))
+                                (unless prefix-p
+                                  (dotimes (i (- *disassem-inst-column-width* (* 2 (+ (inst-length inst) suffix-len prefix-len))))
+                                    (write-char #\space stream))
+                                  (write-char #\space stream))
 
-                            (funcall function chunk inst)
+                                (setf prefix-len (+ (inst-length inst) suffix-len))))
 
-                            (setf prefix-p (null (inst-printer inst)))
+                            (funcall function chunk inst)
 
                             (when control
                               (funcall control chunk inst stream dstate))
 
       (unless (null stream)
         (unless prefix-p
+          (setf prefix-len 0)
           (print-notes-and-newline stream dstate))
         (setf (dstate-output-state dstate) nil)))))
 \f