0.9.1.40:
authorAlexey Dejneka <adejneka@comail.ru>
Mon, 13 Jun 2005 11:05:44 +0000 (11:05 +0000)
committerAlexey Dejneka <adejneka@comail.ru>
Mon, 13 Jun 2005 11:05:44 +0000 (11:05 +0000)
        * 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.

make.sh
src/compiler/fndb.lisp
src/compiler/typetran.lisp
tests/compiler.impure-cload.lisp
tests/run-tests.sh
version.lisp-expr

diff --git a/make.sh b/make.sh
index 8f8d703..3a81875 100755 (executable)
--- a/make.sh
+++ b/make.sh
@@ -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"
index 404e4ef..5225b60 100644 (file)
 
 (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.
   )
index 5d0fa9d..612d2bc 100644 (file)
 \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))
index 39c4d18..c82bef3 100644 (file)
 
 (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)
index 674b965..4060d14 100644 (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
index 9d965c1..3e087f9 100644 (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"