nil)
((csubtypep otype type)
t)
+ ((eq type *empty-type*)
+ nil)
(t
(give-up-ir1-transform)))))
(give-up-ir1-transform))
(ir1-transform-type-predicate
object
- (specifier-type (continuation-value type))))
+ (ir1-transform-specifier-type (continuation-value type))))
;;; This is the IR1 transform for simple type predicates. It checks
;;; whether the single argument is known to (not) be of the
;; source transform another chance, so it all works out OK, in a
;; weird roundabout way. -- WHN 2001-03-18
(if (and (consp spec) (eq (car spec) 'quote))
- (let ((type (specifier-type (cadr spec))))
- (or (let ((pred (cdr (assoc type *backend-type-predicates*
+ (let ((type (careful-specifier-type (cadr spec))))
+ (or (when (not type)
+ (compiler-warn "illegal type specifier for TYPEP: ~S"
+ (cadr spec))
+ `(%typep ,object ,spec))
+ (let ((pred (cdr (assoc type *backend-type-predicates*
:test #'type=))))
(when pred `(,pred ,object)))
(typecase type
\f
;;;; coercion
-(deftransform coerce ((x type) (* *) *)
+(deftransform coerce ((x type) (* *) * :node node)
(unless (constant-continuation-p type)
(give-up-ir1-transform))
- (let ((tspec (specifier-type (continuation-value type))))
+ (let ((tspec (ir1-transform-specifier-type (continuation-value type))))
(if (csubtypep (continuation-type x) tspec)
'x
;; Note: The THE here makes sure that specifiers like
`(the ,(continuation-value type)
,(cond
((csubtypep tspec (specifier-type 'double-float))
- '(%double-float x))
+ '(%double-float x))
;; FIXME: #!+long-float (t ,(error "LONG-FLOAT case needed"))
((csubtypep tspec (specifier-type 'float))
'(%single-float x))
- ((csubtypep tspec (specifier-type 'simple-vector))
- '(coerce-to-simple-vector x))
+ ((and (csubtypep tspec (specifier-type 'simple-vector))
+ (policy node (< safety 3)))
+ `(if (simple-vector-p x)
+ x
+ (replace (make-array (length x)) x)))
+ ;; FIXME: other VECTOR types?
(t
(give-up-ir1-transform)))))))