1.0.2.17: Bypass the hairy AREF transform for simple arrays
authorJuho Snellman <jsnell@iki.fi>
Tue, 6 Feb 2007 08:11:17 +0000 (08:11 +0000)
committerJuho Snellman <jsnell@iki.fi>
Tue, 6 Feb 2007 08:11:17 +0000 (08:11 +0000)
* To improve compilation speed for array-heavy code

src/compiler/array-tran.lisp
version.lisp-expr

index 05df30b..ffc9dda 100644 (file)
          ,@(mapcar (lambda (el)
                      (once-only ((n-val el))
                        `(locally (declare (optimize (safety 0)))
-                                 (setf (svref ,n-vec ,(incf n))
-                                       ,n-val))))
+                          (setf (svref ,n-vec ,(incf n)) ,n-val))))
                    elements)
          ,n-vec))))
 
   (deftransform aref ((array &rest indices))
     (with-row-major-index (array indices index)
       (hairy-data-vector-ref array index)))
+
   (deftransform %aset ((array &rest stuff))
     (let ((indices (butlast stuff)))
       (with-row-major-index (array indices index new-value)
         (hairy-data-vector-set array index new-value)))))
 
+(deftransform aref ((array index) ((or simple-vector
+                                       simple-unboxed-array)
+                                   index))
+  (let ((type (lvar-type array)))
+    (unless (array-type-p type)
+      ;; Not an exactly specified one-dimensional simple array -> punt
+      ;; to the complex version.
+      (give-up-ir1-transform)))
+  `(data-vector-ref array (%check-bound array
+                                        (array-dimension array 0)
+                                        index)))
+
 ;;; Just convert into a HAIRY-DATA-VECTOR-REF (or
 ;;; HAIRY-DATA-VECTOR-SET) after checking that the index is inside the
 ;;; array total size.
index 0338ba1..f189318 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.2.16"
+"1.0.2.17"