# UPGRADED-ARRAY-ELEMENT-TYPE?)
LANG=C
+LC_ALL=C
export LANG
+export LC_ALL
build_started=`date`
echo "//starting build: $build_started"
(defknown coerce (t type-specifier) t
;; Note:
- ;; (1) This is not FLUSHABLE because it's defined to signal errors.
- ;; (2) It's not worth trying to make this FOLDABLE in the
- ;; cross-compiler,because
- ;; (a) it would probably be really hard to make all the
- ;; tricky issues (e.g. which specialized array types are
- ;; supported) match between cross-compiler and target
- ;; compiler, and besides
- ;; (b) leaving it not FOLDABLE lets us use the idiom
- ;; (COERCE FOO 'SOME-SPECIALIZED-ARRAY-TYPE-OR-ANOTHER)
- ;; as a way of delaying the generation of specialized
- ;; array types until runtime, which helps us keep the
- ;; cross-compiler's dumper relatively simple and which
- ;; lets us preserve distinctions which might not even exist
- ;; on the cross-compilation host (because ANSI doesn't
- ;; guarantee that specialized array types exist there).
- ;; FIXME: It's actually not clear that COERCE on non-NUMBER types
- ;; is FOLDABLE at all. Check this.
- (movable #-sb-xc-host foldable)
+ ;; This is not FLUSHABLE because it's defined to signal errors.
+ (movable)
;; :DERIVE-TYPE RESULT-TYPE-SPEC-NTH-ARG 2 ? Nope... (COERCE 1 'COMPLEX)
;; returns REAL/INTEGER, not COMPLEX.
)
\f
;;;; coercion
+;;; Constant-folding.
+;;;
+#-sb-xc-host
+(defoptimizer (coerce optimizer) ((x type) node)
+ (when (and (constant-lvar-p x) (constant-lvar-p type))
+ (let ((value (lvar-value x)))
+ (when (or (numberp value) (characterp value))
+ (constant-fold-call node)
+ t))))
+
(deftransform coerce ((x type) (* *) * :node node)
(unless (constant-lvar-p type)
(give-up-ir1-transform))
(assert (= (isieve 46349) 4792))
+;;; COERCE should not be constant-folded (reported by Nikodemus
+;;; Siivola)
+(let ((f (gensym)))
+ (setf (fdefinition f) (lambda (x) x))
+ (let ((g (compile nil `(lambda () (coerce ',f 'function)))))
+ (setf (fdefinition f) (lambda (x) (1+ x)))
+ (assert (eq (funcall g) (fdefinition f)))))
+
+(let ((x (coerce '(1 11) 'vector)))
+ (incf (aref x 0))
+ (assert (equalp x #(2 11))))
+
\f
(sb-ext:quit :unix-status 104)
export SBCL_ALLOWING_CORE
echo /with SBCL_ALLOWING_CORE=\'$SBCL_ALLOWING_CORE\'
+LANG=C
+LC_ALL=C
+export LANG
+export LC_ALL
+
# "Ten four" is the closest numerical slang I can find to "OK", so
# it's the Unix status value that we expect from a successful test.
# (Of course, zero is the usual success value, but we don't want to
;;; checkins which aren't released. (And occasionally for internal
;;; versions, especially for internal versions off the main CVS
;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"0.9.1.39"
+"0.9.1.40"