0.9.1.40:

* COERCE for objects other than numbers and characters is not
          foldable (fix a bug reported by Nikodemus Siivola).
        * Set LC_ALL to "C" when building SBCL.
        * Set locale to "C" in run-tests.sh.
This commit is contained in:
Alexey Dejneka 2005-06-13 11:05:44 +00:00
parent 3463b85863
commit 00ac8aa578
6 changed files with 32 additions and 19 deletions

View file

@ -53,7 +53,9 @@
# UPGRADED-ARRAY-ELEMENT-TYPE?)
LANG=C
LC_ALL=C
export LANG
export LC_ALL
build_started=`date`
echo "//starting build: $build_started"

View file

@ -17,24 +17,8 @@
(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.
)

View file

@ -537,6 +537,16 @@
;;;; 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))

View file

@ -408,5 +408,17 @@
(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))))
(sb-ext:quit :unix-status 104)

View file

@ -35,6 +35,11 @@ SBCL_ALLOWING_CORE=${1:-$sbclstem}
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

View file

@ -17,4 +17,4 @@
;;; 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"