X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcompiler%2Fseqtran.lisp;h=de9f0ff5596b937c05fd5f7c91ec4883f0bd4bff;hb=2287399f246955badf9d61bf123145e76eaf884d;hp=4a75395fc1fe725a67334bb833238e9d49be7619;hpb=d604a358d8e5eb5587989e0a4f1d31dbe6ac5ffe;p=sbcl.git diff --git a/src/compiler/seqtran.lisp b/src/compiler/seqtran.lisp index 4a75395..de9f0ff 100644 --- a/src/compiler/seqtran.lisp +++ b/src/compiler/seqtran.lisp @@ -153,7 +153,8 @@ (tests `(endp ,index)))) ((csubtypep type (specifier-type 'vector)) (process-vector `(length ,seq-name)) - (places `(aref ,seq-name index))) + (places `(locally (declare (optimize (insert-array-bounds-checks 0))) + (aref ,seq-name index)))) (t (give-up-ir1-transform "can't determine sequence argument type")))) @@ -161,7 +162,7 @@ (process-vector `(array-dimension ,into 0)))) (when found-vector-p (bindings `(length (min ,@(vector-lengths)))) - (tests `(= index length))) + (tests `(>= index length))) `(do (,@(bindings)) ((or ,@(tests)) ,result) (declare ,@(declarations)) @@ -202,7 +203,7 @@ 'list) (t (give-up-ir1-transform - "can't determine result type"))))) + "result type unsuitable"))))) (cond ((and result-type-value (null seqs)) ;; The consing arity-1 cases can be implemented ;; reasonably efficiently as function calls, and the cost @@ -261,7 +262,8 @@ :result '(when (array-has-fill-pointer-p result) (setf (fill-pointer result) index)) :into 'result - :body '(setf (aref result index) funcall-result)) + :body '(locally (declare (optimize (insert-array-bounds-checks 0))) + (setf (aref result index) funcall-result))) result))) @@ -970,7 +972,11 @@ ,n-sequence ,start ,n-end))) (block ,block (macrolet ((maybe-return () - '(let ((,element (aref ,sequence ,index))) + ;; WITH-ARRAY-DATA has already performed bounds + ;; checking, so we can safely elide the checks + ;; in the inner loop. + '(let ((,element (locally (declare (optimize (insert-array-bounds-checks 0))) + (aref ,sequence ,index)))) (when ,done-p-expr (return-from ,block (values ,element @@ -1077,7 +1083,8 @@ (macrolet ((define-find-position (fun-name values-index) `(deftransform ,fun-name ((item sequence &key from-end (start 0) end - key test test-not)) + key test test-not) + (t (or list vector) &rest t)) '(nth-value ,values-index (%find-position item sequence from-end start @@ -1091,7 +1098,8 @@ (macrolet ((define-find-position-if (fun-name values-index) `(deftransform ,fun-name ((predicate sequence &key from-end (start 0) - end key)) + end key) + (t (or list vector) &rest t)) '(nth-value ,values-index (%find-position-if (%coerce-callable-to-fun predicate) @@ -1124,7 +1132,8 @@ (macrolet ((define-find-position-if-not (fun-name values-index) `(deftransform ,fun-name ((predicate sequence &key from-end (start 0) - end key)) + end key) + (t (or list vector) &rest t)) '(nth-value ,values-index (%find-position-if-not (%coerce-callable-to-fun predicate)