-(defun upgraded-element-type-specifier-or-give-up (continuation)
- (let* ((element-ctype (extract-upgraded-element-type continuation))
+(defun upgraded-element-type-specifier-or-give-up (lvar)
+ (let* ((element-ctype (extract-upgraded-element-type lvar))
;;; Array access functions return an object from the array, hence its
;;; type is going to be the array upgraded element type.
(defun extract-upgraded-element-type (array)
;;; Array access functions return an object from the array, hence its
;;; type is going to be the array upgraded element type.
(defun extract-upgraded-element-type (array)
;; Note that this IF mightn't be satisfied even if the runtime
;; value is known to be a subtype of some specialized ARRAY, because
;; we can have values declared e.g. (AND SIMPLE-VECTOR UNKNOWN-TYPE),
;; Note that this IF mightn't be satisfied even if the runtime
;; value is known to be a subtype of some specialized ARRAY, because
;; we can have values declared e.g. (AND SIMPLE-VECTOR UNKNOWN-TYPE),
;;; return type is going to be the same as the new-value for SETF
;;; functions.
(defun assert-new-value-type (new-value array)
;;; return type is going to be the same as the new-value for SETF
;;; functions.
(defun assert-new-value-type (new-value array)
;;; value is NIL, false otherwise.
(defun unsupplied-or-nil (arg)
;;; value is NIL, false otherwise.
(defun unsupplied-or-nil (arg)
\f
;;;; DERIVE-TYPE optimizers
;;; Array operations that use a specific number of indices implicitly
;;; assert that the array is of that rank.
(defun assert-array-rank (array rank)
\f
;;;; DERIVE-TYPE optimizers
;;; Array operations that use a specific number of indices implicitly
;;; assert that the array is of that rank.
(defun assert-array-rank (array rank)
(defoptimizer (array-in-bounds-p derive-type) ((array &rest indices))
(assert-array-rank array (length indices))
(defoptimizer (array-in-bounds-p derive-type) ((array &rest indices))
(assert-array-rank array (length indices))
;;; Figure out the type of the data vector if we know the argument
;;; element type.
(defoptimizer (%with-array-data derive-type) ((array start end))
;;; Figure out the type of the data vector if we know the argument
;;; element type.
(defoptimizer (%with-array-data derive-type) ((array start end))
(when (array-type-p atype)
(specifier-type
`(simple-array ,(type-specifier
(when (array-type-p atype)
(specifier-type
`(simple-array ,(type-specifier
(or (careful-specifier-type
`(,(if simple 'simple-array 'array)
,(cond ((not element-type) t)
(or (careful-specifier-type
`(,(if simple 'simple-array 'array)
,(cond ((not element-type) t)
- ,(cond ((constant-continuation-p dims)
- (let* ((val (continuation-value dims))
+ ,(cond ((constant-lvar-p dims)
+ (let* ((val (lvar-value dims))
(eltype-type (ir1-transform-specifier-type eltype))
(saetp (find-if (lambda (saetp)
(csubtypep eltype-type (sb!vm:saetp-ctype saetp)))
(eltype-type (ir1-transform-specifier-type eltype))
(saetp (find-if (lambda (saetp)
(csubtypep eltype-type (sb!vm:saetp-ctype saetp)))
(sb!vm:saetp-initial-element-default saetp)))
creation-form)
(t
;; error checking for target, disabled on the host because
;; (CTYPE-OF #\Null) is not possible.
#-sb-xc-host
(sb!vm:saetp-initial-element-default saetp)))
creation-form)
(t
;; error checking for target, disabled on the host because
;; (CTYPE-OF #\Null) is not possible.
#-sb-xc-host
(cond
((not (ctypep value (sb!vm:saetp-ctype saetp)))
;; this case will cause an error at runtime, so we'd
(cond
((not (ctypep value (sb!vm:saetp-ctype saetp)))
;; this case will cause an error at runtime, so we'd
- (continuation-value element-type))))
- (len (if (constant-continuation-p length)
- (continuation-value length)
+ (lvar-value element-type))))
+ (len (if (constant-lvar-p length)
+ (lvar-value length)
(t '*))
,(make-list rank :initial-element '*))))
`(let ((header (make-array-header sb!vm:simple-array-widetag ,rank)))
(t '*))
,(make-list rank :initial-element '*))))
`(let ((header (make-array-header sb!vm:simple-array-widetag ,rank)))
;;; If we can tell the rank from the type info, use it instead.
(deftransform array-rank ((array))
;;; If we can tell the rank from the type info, use it instead.
(deftransform array-rank ((array))
;;; If the length has been declared and it's simple, just return it.
(deftransform length ((vector)
((simple-array * (*))))
;;; If the length has been declared and it's simple, just return it.
(deftransform length ((vector)
((simple-array * (*))))
;;; If a simple array with known dimensions, then VECTOR-LENGTH is a
;;; compile-time constant.
(deftransform vector-length ((vector))
;;; If a simple array with known dimensions, then VECTOR-LENGTH is a
;;; compile-time constant.
(deftransform vector-length ((vector))
(if (and (array-type-p vtype)
(not (array-type-complexp vtype)))
(let ((dim (first (array-type-dimensions vtype))))
(if (and (array-type-p vtype)
(not (array-type-complexp vtype)))
(let ((dim (first (array-type-dimensions vtype))))
(deftransform %check-bound ((array dimension index) * * :node node)
(cond ((policy node (and (> speed safety) (= safety 0)))
'index)
(deftransform %check-bound ((array dimension index) * * :node node)
(cond ((policy node (and (> speed safety) (= safety 0)))
'index)