1.0.0.22: Extensible sequences. (EXPERIMENTAL: Do Not Use As Food)
[sbcl.git] / src / compiler / seqtran.lisp
index 0ce0497..de9f0ff 100644 (file)
                        (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"))))
                                     '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
          :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)))
 
 \f
                                 ,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
 (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
 (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)
 (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)