X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcompiler%2Farray-tran.lisp;h=4c4ec20b5e1a8b3ee14e292b05e04d3bd10ec9c6;hb=c6fd5a650d63d358b182777ace8c42c8684f6f9b;hp=387f53f04a6777a36917c742005849143da1f69b;hpb=cfc3b695e6452907fef6492710777511ac4af979;p=sbcl.git diff --git a/src/compiler/array-tran.lisp b/src/compiler/array-tran.lisp index 387f53f..4c4ec20 100644 --- a/src/compiler/array-tran.lisp +++ b/src/compiler/array-tran.lisp @@ -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) (fun-lexically-notinline-p 'vector)) (values nil t) `(locally (declare (notinline list vector)) - ,form))) + ;; 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) + form)) + form)))) ;;; 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 @@ -323,7 +329,7 @@ (truly-the ,result-spec (initialize-vector ,alloc-form ,@(map 'list (lambda (elt) - `(the ,elt-spec ,elt)) + `(the ,elt-spec ',elt)) contents))))))) ;; any other :INITIAL-CONTENTS (initial-contents