X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=doc%2Fmanual%2Fefficiency.texinfo;h=6931ed03533bd4f40e7011a7b6e0bd7b91200e7c;hb=cefe278d2145e840f44163ad2d1d6b04a8da9191;hp=4643f90a399ddcfbcfb4213e7363913b3f6d114f;hpb=2a4fabe1541b905591fbd6b83122209df6a48fab;p=sbcl.git diff --git a/doc/manual/efficiency.texinfo b/doc/manual/efficiency.texinfo index 4643f90..6931ed0 100644 --- a/doc/manual/efficiency.texinfo +++ b/doc/manual/efficiency.texinfo @@ -162,15 +162,53 @@ it would not be in the following situation: because both the allocation of the @code{&rest} list and the variable binding are outside the scope of the @code{optimize} declaration. -There are many cases when dynamic-extent declarations could be useful. -At present, SBCL implements +There are many cases when @code{dynamic-extent} declarations could be +useful. At present, SBCL implements -@itemize +@itemize @item Stack allocation of @code{&rest} lists, where these are declared @code{dynamic-extent}. +@item +Stack allocation of @code{list} and @code{list*}, whose result is +bound to a variable, declared @code{dynamic-extent}, such as + +@lisp +(let ((list (list 1 2 3))) + (declare (dynamic-extent list) + ...)) +@end lisp + +or + +@lisp +(flet ((f (x) + (declare (dynamic-extent x)) + ...)) + ... + (f (list 1 2 3)) + ...) +@end lisp + +@item +Stack allocation of simple forms of @code{make-array}, whose result is +bound to a variable, declared @code{dynamic-extent}. The resulting +array should be one-dimensional, the only allowed keyword argument is +@code{:element-type}. + +Notice, that stack space is limited, so allocation of a large vector +may cause stack overflow and abnormal termination of the SBCL process. + +@item +Stack allocation of closures, defined with @code{flet} or +@code{labels} with a bound declaration @code{dynamic-extent}. +Closed-over variables, which are assigned (either inside or outside +the closure) are still allocated on the heap. Blocks and tags are also +allocated on the heap, unless all non-local control transfers to them +are compiled with zero @code{safety}. + @end itemize Future plans include