1.0.5.3: compiling a SUBSEQ on a SIMPLE-VECTOR should not give notes
authorNikodemus Siivola <nikodemus@random-state.net>
Sun, 29 Apr 2007 14:30:48 +0000 (14:30 +0000)
committerNikodemus Siivola <nikodemus@random-state.net>
Sun, 29 Apr 2007 14:30:48 +0000 (14:30 +0000)
 * One type declaration, one TRULY-THE, and two test-cases.

src/compiler/seqtran.lisp
tests/compiler.pure.lisp
version.lisp-expr

index a3126da..2699964 100644 (file)
            ((<= i ,src-offset))
          (declare (optimize (insert-array-bounds-checks 0)))
          (setf (aref ,dst (1- i)) (aref ,src (1- i))))
-      `(do ((i (+ ,src-offset ,length) (1- i))
+      ;; KLUDGE: The compiler is not able to derive that (+ offset
+      ;; length) must be a fixnum, but arrives at (unsigned-byte 29).
+      ;; We, however, know it must be so, as by this point the bounds
+      ;; have already been checked.
+      `(do ((i (truly-the fixnum (+ ,src-offset ,length)) (1- i))
             (j (+ ,dst-offset ,length) (1- j)))
            ((<= i ,src-offset))
-         (declare (optimize (insert-array-bounds-checks 0)))
+         (declare (optimize (insert-array-bounds-checks 0))
+                  (type (integer 0 #.sb!xc:array-dimension-limit) j i))
          (setf (aref ,dst (1- j)) (aref ,src (1- i))))))
 
 (deftransform subseq ((seq start &optional end)
index 64acb35..c3ce69e 100644 (file)
                                       42)))
                 (unbound-variable ()
                   :error)))))
+
+;;; No compiler notes from compiling SUBSEQ SIMPLE-VECTOR.
+(handler-bind ((sb-ext:compiler-note 'error))
+  (assert
+   (equalp #(2 3)
+           (funcall (compile nil `(lambda (s p e)
+                                    (declare (optimize speed)
+                                             (simple-vector s))
+                                    (subseq s p e)))
+                    (vector 1 2 3 4)
+                    1
+                    3))))
+
+;;; No compiler notes from compiling COPY-SEQ SIMPLE-VECTOR.
+(handler-bind ((sb-ext:compiler-note 'error))
+  (assert
+   (equalp #(1 2 3 4)
+           (funcall (compile nil `(lambda (s)
+                                    (declare (optimize speed)
+                                             (simple-vector s))
+                                    (copy-seq s)))
+                    (vector 1 2 3 4)))))
index 3c1b629..729077b 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".)
-"1.0.5.2"
+"1.0.5.3"