Update of /cvsroot/sbcl/sbcl/src/compiler
In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv18853/src/compiler
18.104.22.168: more MAKE-ARRAY goodness
Consider (MAKE-ARRAY '(3) :INITIAL-CONTENTS (LIST X Y Z)):
The transform for LIST dimensions replaces this with an identical
call, except that the dimensions will be 3.
The transform for INTEGER dimensions fires, but does not yet
see the (LIST X Y Z) in INITIAL-CONTENTS, since it is now an
argument to the lambda introduced by the previous call.
One option would be to delay the latter transform if we don't see
how to compile it nicely, because after a couple of IR1-OPTIMIZE
passes the call to LIST will be there, and the intermediate lambda
However, because multiple roundtrips like that suck, instead make
the source transform for MAKE-ARRAY smart enough to recognize this
case, and transform to the integer argument case directly.
...now, this makes me think we really should try to eliminate /
simplify lambdas introduced by TRANSFORM-CALL up front somehow.
RCS file: /cvsroot/sbcl/sbcl/src/compiler/array-tran.lisp,v
retrieving revision 1.91
retrieving revision 1.92
diff -u -d -r1.91 -r1.92
--- array-tran.lisp 17 May 2009 17:30:23 -0000 1.91
+++ array-tran.lisp 18 May 2009 09:17:49 -0000 1.92
@@ -233,13 +233,19 @@
;;; Prevent open coding DIMENSION and :INITIAL-CONTENTS arguments,
;;; so that we can pick them apart.
-(define-source-transform make-array (&whole form &rest args)
- (declare (ignore args))
+(define-source-transform make-array (&whole form dimensions &rest keyargs
+ &environment env)
(if (and (fun-lexically-notinline-p 'list)
(values nil t)
`(locally (declare (notinline list vector))
+ ;; Transform '(3) style dimensions to integer args directly.
+ ,(if (sb!xc:constantp dimensions env)
+ (let ((dims (constant-form-value dimensions env)))
+ (if (and (listp dims) (= 1 (length dims)))
+ `(make-array ',(car dims) ,@keyargs)
;;; This baby is a bit of a monster, but it takes care of any MAKE-ARRAY
;;; call which creates a vector with a known element type -- and tries