Update of /cvsroot/sbcl/sbcl
In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv22761
Modified Files:
NEWS OPTIMIZATIONS version.lisp-expr
Log Message:
1.0.28.51: better MAKE-ARRAY transforms
* Add a source transform for MAKE-ARRAY that declaims LIST and VECTOR
as NOTINLINE, so the the MAKE-ARRAY deftransforms are able to pick
them apart (for DIMENSIONS and :INITIAL-CONTENTS.)
* INITIALIZE-VECTOR is a new magic function with a IR2-CONVERT
transform. It's purpose is to allow open coding :INITIAL-CONTENTS
initialization without inhibiting stack allocation.
* Turns out that making stack allocation decisions during locall
analysis is not enough since optimization iterates: if a transform
occurs and introduces new LVARs that would be good for DX after
the locall analysis has run for the combination, the new LVARs
will not get their share of stacky goodness. Therefore, after
a transform propagate DX information to the new functional
explicitly (see MAYBE-PROPAGATE-DYNAMIC-EXTENT.)
* The new logic is in TRANSFORM-MAKE-ARRAY-VECTOR, which handles
all the cases of vector allocation with a known element type:
** :INITIAL-CONTENTS (LIST ...), (VECTOR ...) and (BACKQ-LIST ...)
are picked apart when the length matches the vector length,
and their arguments are spliced into the call.
Constant :INITIAL-CONTENTS is picked apart as well.
Initialization is done using INITIALIZE-VECTOR.
** Otherwise :INITIAL-CONTENTS is splatted in place using
REPLACE after we have checked that the length matches.
** :INITIAL-ELEMENT not EQL to the default element uses
FILL.
** Otherwise the default initialization is fine.
Some additional hair here, since MAYBE-PROPAGATE-DYNAMIC-EXTENT
cannot deal with OPTIONAL-DISPATCH functionals. So to ensure we get
full benefit of it, make sure the lambdas we transform to have only
required arguments -- courtesy of new ELIMINATE-KEYWORD-ARGUMENT
utility. (Note: it might be worth it to do something like this for
many cases automatically, to reduce the number of lambdas the
compiler generates. For inline lambdas we could do the whole &key
handling _before_ the lambda is converted...)
* Identify the case of (LIST N) as dimensions as being a vector,
and delegate to TRANSFORM-MAKE-ARRAY-VECTOR.
* More efficient allocation of simple multidimensional arrays in
the presence of :INITIAL-CONTENTS (still slow, though) and
:INITIAL-ELEMENT (not bad.)
* Fix the source transform for VECTOR so that it too can stack
allocate.
* Updates tests and docs.
Index: NEWS
===================================================================
RCS file: /cvsroot/sbcl/sbcl/NEWS,v
retrieving revision 1.1523
retrieving revision 1.1524
diff -u -d -r1.1523 -r1.1524
--- NEWS 16 May 2009 11:24:29 -0000 1.1523
+++ NEWS 16 May 2009 12:23:13 -0000 1.1524
@@ -25,8 +25,18 @@
* optimization: result of (FILL (MAKE-ARRAY ...) ...) and (REPLACE
(MAKE-ARRAY ...) ...) can be stack allocated if the result of MAKE-ARRAY
form can be.
+ * optimization: result of call to VECTOR can now be stack allocated.
+ * optimization: MAKE-ARRAY with :INITIAL-CONTENTS is now vastly faster
+ as long as the resulting array is one-dimensional and has a known
+ element type. In particular, :INITIAL-CONTENTS (LIST ...) where the
+ length of the list matches the known length of the vector does not
+ allocate the list as an intermediate step. Ditto for VECTOR and simple
+ backquoted forms.
+ * optimization: MAKE-ARRAY can now stack allocate in the presence of
+ :INITIAL-CONTENTS and :INITIAL-ELEMENT as long as the result has a
+ known element type, and is known to be simple and one dimensional.
* improvement: SBCL now emits a compiler note where stack allocation was
- requested but could not be provided.
+ requested but could not be provided (not in all cases, unfortunately)
* improvement: better MACHINE-VERSION responses. (thanks to Josh Elsasser)
* improvement: pretty-printing loop has been implemented properly. (thanks
to Tobias Rittweiler)
Index: OPTIMIZATIONS
===================================================================
RCS file: /cvsroot/sbcl/sbcl/OPTIMIZATIONS,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- OPTIMIZATIONS 2 Jan 2009 16:05:28 -0000 1.42
+++ OPTIMIZATIONS 16 May 2009 12:23:13 -0000 1.43
@@ -209,6 +209,10 @@
is valid if the vector is being allocated in the heap, but not if it is being
allocated on the stack. You could remove this optimization, but that makes
the heap-allocated case somewhat slower...)
+
+To do this, extend ALLOCATE-VECTOR with ALLOW-JUNK argument, and when
+stack allocating don't zero if it is true -- and probably ALLOW-JUNK iff
+the vector is a specialized one (cannot have pointers.)
--------------------------------------------------------------------------------
#28
a. Accessing raw slots in structure instances is more inefficient than
Index: version.lisp-expr
===================================================================
RCS file: /cvsroot/sbcl/sbcl/version.lisp-expr,v
retrieving revision 1.4467
retrieving revision 1.4468
diff -u -d -r1.4467 -r1.4468
--- version.lisp-expr 16 May 2009 11:26:36 -0000 1.4467
+++ version.lisp-expr 16 May 2009 12:23:13 -0000 1.4468
@@ -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.28.50"
+"1.0.28.51"
|