0.8.21.2:
authorChristophe Rhodes <csr21@cam.ac.uk>
Sun, 27 Mar 2005 18:34:42 +0000 (18:34 +0000)
committerChristophe Rhodes <csr21@cam.ac.uk>
Sun, 27 Mar 2005 18:34:42 +0000 (18:34 +0000)
Merge mainly MISC fixes held over from pre-freeze

BUGS
NEWS
src/code/pred.lisp
src/compiler/float-tran.lisp
src/compiler/srctran.lisp
version.lisp-expr

diff --git a/BUGS b/BUGS
index 0f5554a..bc3eebd 100644 (file)
--- a/BUGS
+++ b/BUGS
@@ -2079,11 +2079,6 @@ WORKAROUND:
      argument type new CAST to KEYWORD is generated. The compiler
      loops forever.
 
-376: MISC.563
-  Type deriver for CONJUGATE thinks that it returns an object of the
-  same type as its argument, which is wrong for such types as (EQL
-  #C(1 2)).
-
 377: Memory fault error reporting
   On those architectures where :C-STACK-IS-CONTROL-STACK is in
   *FEATURES*, we handle SIG_MEMORY_FAULT (SEGV or BUS) on an altstack,
diff --git a/NEWS b/NEWS
index 451b396..cd649a0 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,10 +1,19 @@
 changes in sbcl-0.8.22 relative to sbcl-0.8.21:
   * fixed inference of the upper bound of an iteration variable.
     (reported by Rajat Datta).
+  * fixed bug 376: CONJUGATE type deriver.
   * fixed some bugs revealed by Paul Dietz' test suite:
     ** MISC.549 and similar: late transformation of unsafe type
        assertions into derived types caused unexpected code
        transformations.
+    ** SCALE-FLOAT type deriver is less wrong.
+    ** type derivers for EXP, LOG and similar functions compute result
+       types for complex arguments better.
+    ** (MISC.563) CONJUGATE type deriver works for very restricted
+       complex types.
+    ** out-of-line type testers for character strings are available.
+    ** EQUAL compiler transform understands specialness of objects
+       of type BIT-VECTOR.
 
 changes in sbcl-0.8.21 (0.9alpha.1?) relative to sbcl-0.8.20:
   * incompatible change: thread support for non-NPTL systems has
index 5305ac0..1ccc065 100644 (file)
@@ -48,6 +48,7 @@
   (def-type-predicate-wrapper atom)
   (def-type-predicate-wrapper base-char-p)
   (def-type-predicate-wrapper base-string-p)
+  #!+sb-unicode (def-type-predicate-wrapper character-string-p)
   (def-type-predicate-wrapper bignump)
   (def-type-predicate-wrapper bit-vector-p)
   (def-type-predicate-wrapper characterp)
@@ -82,6 +83,7 @@
   (def-type-predicate-wrapper simple-array-p)
   (def-type-predicate-wrapper simple-bit-vector-p)
   (def-type-predicate-wrapper simple-base-string-p)
+  #!+sb-unicode (def-type-predicate-wrapper simple-character-string-p)
   (def-type-predicate-wrapper simple-string-p)
   (def-type-predicate-wrapper simple-vector-p)
   (def-type-predicate-wrapper single-float-p)
index 89c60d9..9e6033c 100644 (file)
            (ex-hi (numeric-type-high ex))
            (new-lo nil)
            (new-hi nil))
-       (when (and f-hi ex-hi)
-         (setf new-hi (scale-bound f-hi ex-hi)))
-       (when (and f-lo ex-lo)
-         (setf new-lo (scale-bound f-lo ex-lo)))
+       (when f-hi
+         (if (< (float-sign (type-bound-number f-hi)) 0.0)
+             (when ex-lo
+               (setf new-hi (scale-bound f-hi ex-lo)))
+             (when ex-hi
+               (setf new-hi (scale-bound f-hi ex-hi)))))
+       (when f-lo
+         (if (< (float-sign (type-bound-number f-lo)) 0.0)
+             (when ex-hi
+               (setf new-lo (scale-bound f-lo ex-hi)))
+             (when ex-lo
+               (setf new-lo (scale-bound f-lo ex-lo)))))
        (make-numeric-type :class (numeric-type-class f)
                           :format (numeric-type-format f)
                           :complexp :real
   (etypecase arg
     (numeric-type
      (cond ((eq (numeric-type-complexp arg) :complex)
-           (make-numeric-type :class (numeric-type-class arg)
-                              :format (numeric-type-format arg)
-                              :complexp :complex))
+           (complex-float-type arg))
           ((numeric-type-real-p arg)
            ;; The argument is real, so let's find the intersection
            ;; between the argument and the domain of the function.
                           nil nil))
    #'tan))
 
-;;; CONJUGATE always returns the same type as the input type.
-;;;
-;;; FIXME: ANSI allows any subtype of REAL for the components of COMPLEX.
-;;; So what if the input type is (COMPLEX (SINGLE-FLOAT 0 1))?
-;;; Or (EQL #C(1 2))?
 (defoptimizer (conjugate derive-type) ((num))
-  (lvar-type num))
+  (one-arg-derive-type num
+    (lambda (arg)
+      (flet ((most-negative-bound (l h)
+              (and l h
+                   (if (< (type-bound-number l) (- (type-bound-number h)))
+                       l
+                       (set-bound (- (type-bound-number h)) (consp h)))))
+            (most-positive-bound (l h)
+              (and l h
+                   (if (> (type-bound-number h) (- (type-bound-number l)))
+                       h
+                       (set-bound (- (type-bound-number l)) (consp l))))))
+       (if (numeric-type-real-p arg)
+           (lvar-type num)
+           (let ((low (numeric-type-low arg))
+                 (high (numeric-type-high arg)))
+             (let ((new-low (most-negative-bound low high))
+                   (new-high (most-positive-bound low high)))
+             (modified-numeric-type arg :low new-low :high new-high))))))
+    #'conjugate))
 
 (defoptimizer (cis derive-type) ((num))
   (one-arg-derive-type num
-     (lambda (arg)
-       (sb!c::specifier-type
-       `(complex ,(or (numeric-type-format arg) 'float))))
-     #'cis))
+    (lambda (arg)
+      (sb!c::specifier-type
+       `(complex ,(or (numeric-type-format arg) 'float))))
+    #'cis))
 
 ) ; PROGN
 \f
index e3f1985..44930ba 100644 (file)
 
 ;;; similarly to the EQL transform above, we attempt to constant-fold
 ;;; or convert to a simpler predicate: mostly we have to be careful
-;;; with strings.
+;;; with strings and bit-vectors.
 (deftransform equal ((x y) * *)
   "convert to simpler equality predicate"
   (let ((x-type (lvar-type x))
        (y-type (lvar-type y))
-       (string-type (specifier-type 'string)))
+       (string-type (specifier-type 'string))
+       (bit-vector-type (specifier-type 'bit-vector)))
     (cond
       ((same-leaf-ref-p x y) t)
       ((and (csubtypep x-type string-type)
            (csubtypep y-type string-type))
        '(string= x y))
-      ((and (or (not (types-equal-or-intersect x-type string-type))
-               (not (types-equal-or-intersect y-type string-type)))
+      ((and (csubtypep x-type bit-vector-type)
+           (csubtypep y-type bit-vector-type))
+       '(bit-vector-= x y))
+      ;; if at least one is not a string, and at least one is not a
+      ;; bit-vector, then we can reason from types.
+      ((and (not (and (types-equal-or-intersect x-type string-type)
+                     (types-equal-or-intersect y-type string-type)))
+           (not (and (types-equal-or-intersect x-type bit-vector-type)
+                     (types-equal-or-intersect y-type bit-vector-type)))
            (not (types-equal-or-intersect x-type y-type)))
        nil)
       (t (give-up-ir1-transform)))))
index a88d819..39bf0d9 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.8.21.1"
+"0.8.21.2"