0.8.0.70:
[sbcl.git] / src / compiler / array-tran.lisp
index 9b77313..9d0df27 100644 (file)
@@ -58,7 +58,8 @@
    array
    (make-array-type :complexp t
                     :element-type *wild-type*)
-   (lexenv-policy (node-lexenv (continuation-dest array)))))
+   (lexenv-policy (node-lexenv (continuation-dest array))))
+  nil)
 
 ;;; Return true if ARG is NIL, or is a constant-continuation whose
 ;;; value is NIL, false otherwise.
 (defoptimizer (%with-array-data derive-type) ((array start end))
   (let ((atype (continuation-type array)))
     (when (array-type-p atype)
-      (values-specifier-type
-       `(values (simple-array ,(type-specifier
-                               (array-type-specialized-element-type atype))
-                             (*))
-               index index index)))))
+      (specifier-type
+       `(simple-array ,(type-specifier
+                       (array-type-specialized-element-type atype))
+                     (*))))))
 
 (defoptimizer (array-row-major-index derive-type) ((array &rest indices))
   (assert-array-rank array (length indices))
                     (continuation-value element-type))
                    (t
                     '*))
-            ,(cond ((not simple)
-                    '*)
-                   ((constant-continuation-p dims)
-                    (let ((val (continuation-value dims)))
-                      (if (listp val) val (list val))))
+            ,(cond ((constant-continuation-p dims)
+                    (let* ((val (continuation-value dims))
+                          (cdims (if (listp val) val (list val))))
+                     (if (or simple (/= (length cdims) 1))
+                         cdims
+                         '(*))))
                    ((csubtypep (continuation-type dims)
                                (specifier-type 'integer))
                     '(*))
           (when (constant-continuation-p initial-element)
             (let ((value (continuation-value initial-element)))
               (cond
-                ((not (csubtypep (ctype-of value)
-                                 (saetp-ctype saetp)))
+                ((not (ctypep value (saetp-ctype saetp)))
                  ;; this case will cause an error at runtime, so we'd
                  ;; better WARN about it now.
                  (compiler-warn "~@<~S is not a ~S (which is the ~
                                 value
                                 (type-specifier (saetp-ctype saetp))
                                 eltype))
-                ((not (csubtypep (ctype-of value) eltype-type))
+                ((not (ctypep value eltype-type))
                  ;; this case will not cause an error at runtime, but
                  ;; it's still worth STYLE-WARNing about.
                  (compiler-style-warn "~S is not a ~S."
 
 ;;; If a simple array with known dimensions, then VECTOR-LENGTH is a
 ;;; compile-time constant.
-(deftransform vector-length ((vector) ((simple-array * (*))))
+(deftransform vector-length ((vector))
   (let ((vtype (continuation-type vector)))
-    (if (array-type-p vtype)
+    (if (and (array-type-p vtype)
+            (not (array-type-complexp vtype)))
        (let ((dim (first (array-type-dimensions vtype))))
          (when (eq dim '*) (give-up-ir1-transform))
          dim)
       (cond ((csubtypep type (specifier-type '(simple-array * (*))))
             ;; no array header
             nil)
-           ((and (listp dims) (> (length dims) 1))
+           ((and (listp dims) (/= (length dims) 1))
             ;; multi-dimensional array, will have a header
             t)
            (t