* new feature: experimental :EMIT-CFASL parameter to COMPILE-FILE can
be used to output toplevel compile-time effects into a separate .CFASL
file.
+ * optimization: COERCE to SIMPLE-STRING and recognizable one-dimenstional
+ subtypes of SIMPLE-ARRAY is upto 70% faster when the coercion is actually
+ needed.
* optimization: division of floating point numbers by constants uses
multiplication by reciprocal when an exact reciprocal exists.
* optimization: multiplication of single- and double-floats floats by
;; FIXME: #!+long-float (t ,(error "LONG-FLOAT case needed"))
((csubtypep tspec (specifier-type 'float))
'(%single-float x))
- ((and (csubtypep tspec (specifier-type 'simple-vector))
- ;; Can we avoid checking for dimension issues like
- ;; (COERCE FOO '(SIMPLE-VECTOR 5)) returning a
- ;; vector of length 6?
- (or (policy node (< safety 3)) ; no need in unsafe code
- (and (array-type-p tspec) ; no need when no dimensions
- (equal (array-type-dimensions tspec) '(*)))))
- `(if (simple-vector-p x)
+ ;; Special case this one: SIMPLE-STRING is a union-type.
+ ((type= tspec (specifier-type 'simple-string))
+ `(if (typep x 'simple-string)
x
- (replace (make-array (length x)) x)))
- ;; FIXME: other VECTOR types?
+ (replace (make-array (length x) :element-type 'character) x)))
+ ;; Handle specialized element types.
+ ((csubtypep tspec (specifier-type '(simple-array * (*))))
+ (dolist (etype sb!kernel::*specialized-array-element-types*
+ (give-up-ir1-transform))
+ (when etype
+ (let ((spec `(simple-array ,etype (*))))
+ (when (and (csubtypep tspec (specifier-type spec))
+ ;; Can we avoid checking for dimension issues like (COERCE FOO
+ ;; '(SIMPLE-VECTOR 5)) returning a vector of length 6?
+ (or (policy node (< safety 3)) ; no need in unsafe code
+ (and (array-type-p tspec) ; no need when no dimensions
+ (equal (array-type-dimensions tspec) '(*)))))
+ (return
+ `(if (typep x ',spec)
+ x
+ (replace (make-array (length x) :element-type ',etype) x))))
+ (give-up-ir1-transform)))))
(t
(give-up-ir1-transform)))))))