0.8.3.94:
[sbcl.git] / src / compiler / debug-dump.lisp
index 7d4d71c..ef81699 100644 (file)
        (when (eq (block-info block) 2block)
          (unless (eql (source-path-tlf-number
                        (node-source-path
-                        (continuation-next
-                         (block-start block))))
+                        (block-start-node block)))
                       res)
            (setq res nil)))
-       
+
        (dolist (loc (ir2-block-locations 2block))
          (unless (eql (source-path-tlf-number
                        (node-source-path
       (write-var-integer (length locations) *byte-buffer*)
       (let ((2block (block-info block)))
        (write-var-integer (+ (length locations) 1) *byte-buffer*)
-       (dump-1-location (continuation-next (block-start block))
+       (dump-1-location (block-start-node block)
                         2block :block-start tlf-num
                         (ir2-block-%label 2block)
                         (ir2-block-live-out 2block)
 ;;; a vector whose element size is an integer multiple of output byte
 ;;; size.
 (defun coerce-to-smallest-eltype (seq)
-  (let ((maxoid #-sb-xc-host 0
-               ;; An initial value of 255 prevents us from
-               ;; specializing the array to anything smaller than
-               ;; (UNSIGNED-BYTE 8), which keeps the cross-compiler's
-               ;; portable specialized array output functions happy.
-               #+sb-xc-host 255))
+  (let ((maxoid 0))
     (flet ((frob (x)
             (if (typep x 'unsigned-byte)
                 (when (>= x maxoid)
            (frob i))
          (dovector (i seq)
            (frob i)))
-      (coerce seq `(simple-array (integer 0 ,maxoid) (*))))))
+      (let ((specializer `(unsigned-byte
+                          ,(etypecase maxoid
+                             ((unsigned-byte 8) 8)
+                             ((unsigned-byte 16) 16)
+                             ((unsigned-byte 32) 32)))))
+       ;; cross-compilers beware! It would be possible for the
+       ;; upgraded-array-element-type of (UNSIGNED-BYTE 16) to be
+       ;; (SIGNED-BYTE 17) or (UNSIGNED-BYTE 23), and this is
+       ;; completely valid by ANSI.  However, the cross-compiler
+       ;; doesn't know how to dump (in practice) anything but the
+       ;; above three specialized array types, so make it break here
+       ;; if this is violated.
+       #+sb-xc-host
+       (aver
+        ;; not SB!XC:UPGRADED-ARRAY-ELEMENT-TYPE, because we are
+        ;; worried about whether the host's implementation of arrays.
+        (let ((uaet (upgraded-array-element-type specializer)))
+          (dolist (et '((unsigned-byte 8)
+                        (unsigned-byte 16)
+                        (unsigned-byte 32))
+                   nil)
+            (when (and (subtypep et uaet) (subtypep uaet et))
+              (return t)))))
+       (coerce seq `(simple-array ,specializer (*)))))))
 \f
 ;;;; variables