Update of /cvsroot/sbcl/sbcl/src/compiler
In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv19883/src/compiler
Modified Files:
array-tran.lisp
Log Message:
1.0.6.29: improved WITH-ARRAY-DATA on simple multi-dimensional arrays
* Instead of looping to find the underlying one-dimensional simple
array, just return it directly.
Index: array-tran.lisp
===================================================================
RCS file: /cvsroot/sbcl/sbcl/src/compiler/array-tran.lisp,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -d -r1.76 -r1.77
--- array-tran.lisp 7 May 2007 00:42:37 -0000 1.76
+++ array-tran.lisp 6 Jun 2007 02:23:46 -0000 1.77
@@ -666,10 +666,23 @@
:node node
:policy (> speed space))
"inline non-SIMPLE-vector-handling logic"
- (let ((element-type (upgraded-element-type-specifier-or-give-up array)))
- `(%with-array-data-macro array start end
- :unsafe? ,(policy node (= safety 0))
- :element-type ,element-type)))
+ (let ((element-type (upgraded-element-type-specifier-or-give-up array))
+ (type (lvar-type array)))
+ (if (and (array-type-p type)
+ (listp (array-type-dimensions type))
+ (not (null (cdr (array-type-dimensions type)))))
+ ;; If it's a simple multidimensional array, then just return its
+ ;; data vector directly rather than going through
+ ;; %WITH-ARRAY-DATA-MACRO. SBCL doesn't generally generate code
+ ;; that would use this currently, but we have encouraged users
+ ;; to use WITH-ARRAY-DATA and we may use it ourselves at some
+ ;; point in the future for optimized libraries or similar.
+ `(let ((data (truly-the (simple-array ,element-type (*))
+ (%array-data-vector array))))
+ (values data 0 (length data) 0))
+ `(%with-array-data-macro array start end
+ :unsafe? ,(policy node (= safety 0))
+ :element-type ,element-type))))
;;;; array accessors
|