From 1a60ff79067ec697c476185e0c79565dacf8c8c0 Mon Sep 17 00:00:00 2001 From: Nikodemus Siivola Date: Sun, 29 Apr 2007 14:30:48 +0000 Subject: [PATCH] 1.0.5.3: compiling a SUBSEQ on a SIMPLE-VECTOR should not give notes * One type declaration, one TRULY-THE, and two test-cases. --- src/compiler/seqtran.lisp | 9 +++++++-- tests/compiler.pure.lisp | 22 ++++++++++++++++++++++ version.lisp-expr | 2 +- 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/src/compiler/seqtran.lisp b/src/compiler/seqtran.lisp index a3126da..2699964 100644 --- a/src/compiler/seqtran.lisp +++ b/src/compiler/seqtran.lisp @@ -890,10 +890,15 @@ ((<= 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) diff --git a/tests/compiler.pure.lisp b/tests/compiler.pure.lisp index 64acb35..c3ce69e 100644 --- a/tests/compiler.pure.lisp +++ b/tests/compiler.pure.lisp @@ -2226,3 +2226,25 @@ 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))))) diff --git a/version.lisp-expr b/version.lisp-expr index 3c1b629..729077b 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -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" -- 1.7.10.4