X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcompiler%2Farray-tran.lisp;h=baf1b9809d92df8c8f80bc3b3ca32e43698c60a3;hb=7374cac4bf6ad3b9f109e4a4d0558325b2cad230;hp=0610986eb963f22786fbbc938553036408c4de74;hpb=f5907ea4f056a287022e4bce93c9b711b4133e5e;p=sbcl.git diff --git a/src/compiler/array-tran.lisp b/src/compiler/array-tran.lisp index 0610986..baf1b98 100644 --- a/src/compiler/array-tran.lisp +++ b/src/compiler/array-tran.lisp @@ -98,6 +98,10 @@ (values element-type (when (eq *wild-type* element-type) (apply #'type-union element-supertypes))))) + (member-type + ;; Convert member-type to an union-type. + (array-type-upgraded-element-type + (apply #'type-union (mapcar #'ctype-of (member-type-members type))))) (t ;; KLUDGE: there is no good answer here, but at least ;; *wild-type* won't cause HAIRY-DATA-VECTOR-{REF,SET} to be @@ -165,6 +169,11 @@ (block nil (let ((dimensions (array-type-dimensions-or-give-up (lvar-conservative-type array)))) + ;; Might be *. (Note: currently this is never true, because the type + ;; derivation infers the rank from the call to ARRAY-IN-BOUNDS-P, but + ;; let's keep this future proof.) + (when (eq '* dimensions) + (give-up-ir1-transform "array bounds unknown")) ;; shortcut for zero dimensions (when (some (lambda (dim) (and (bound-known-p dim) (zerop dim))) @@ -176,9 +185,11 @@ (flet ((subscript-bounds (subscript) (let* ((type1 (lvar-type subscript)) (type2 (if (csubtypep type1 (specifier-type 'integer)) - (weaken-integer-type type1) + (weaken-integer-type type1 :range-only t) (give-up))) - (low (numeric-type-low type2)) + (low (if (integer-type-p type2) + (numeric-type-low type2) + (give-up))) (high (numeric-type-high type2))) (cond ((and (or (not (bound-known-p low)) (minusp low)) @@ -1094,7 +1105,8 @@ `(deftransform ,name ((array index ,@extra)) (let* ((type (lvar-type array)) (element-type (array-type-upgraded-element-type type)) - (declared-type (array-type-declared-element-type type))) + (declared-type (type-specifier + (array-type-declared-element-type type)))) ;; If an element type has been declared, we want to ;; use that information it for type checking (even ;; if the access can't be optimized due to the array