* bug fix: redefining a class definition which failed due to a
previous accessor / function clash now works (but see BUGS entry
#380 for more problems in this area). (thanks to Zach Beane)
+ * on x86 compiler supports stack allocation of results of simple
+ calls of MAKE-ARRAY, bound to variables, declared DYNAMIC-EXTENT.
* fixed some bugs related to Unicode integration:
** the restarts for recovering from input and output encoding
errors only appear when there is in fact such an error to
@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
(in-package "SB!VM")
\f
-;;;; allocation
+;;;; Note: On other platforms ALLOCATE-VECTOR is an assembly routine,
+;;;; but on X86 it is a VOP.
-(define-assembly-routine (allocate-vector
- (:policy :fast-safe)
- (:translate allocate-vector)
- (:arg-types positive-fixnum
- positive-fixnum
- positive-fixnum))
- ((:arg type unsigned-reg eax-offset)
- (:arg length any-reg ebx-offset)
- (:arg words any-reg ecx-offset)
- (:res result descriptor-reg edx-offset))
- (inst mov result (+ (1- (ash 1 n-lowtag-bits))
- (* vector-data-offset n-word-bytes)))
- (inst add result words)
- (inst and result (lognot lowtag-mask))
- (pseudo-atomic
- (allocation result result)
- (inst lea result (make-ea :byte :base result :disp other-pointer-lowtag))
- (storew type result 0 other-pointer-lowtag)
- (storew length result vector-length-slot other-pointer-lowtag))
- (inst ret))
-\f
;;;; Note: CMU CL had assembly language primitives for hashing strings,
;;;; but SBCL doesn't.
(:variant t))
\f
;;;; special-purpose inline allocators
+(defoptimizer (allocate-vector stack-allocate-result) ((type length words))
+ t)
+
+(define-vop (allocate-vector)
+ (:args (type :scs (unsigned-reg))
+ (length :scs (any-reg))
+ (words :scs (any-reg)))
+ (:results (result :scs (descriptor-reg) :from :load))
+ (:arg-types positive-fixnum
+ positive-fixnum
+ positive-fixnum)
+ (:translate allocate-vector)
+ (:policy :fast-safe)
+ (:node-var node)
+ (:generator 100
+ (inst lea result (make-ea :byte :base words :disp
+ (+ (1- (ash 1 n-lowtag-bits))
+ (* vector-data-offset n-word-bytes))))
+ (inst and result (lognot lowtag-mask))
+ (let ((stack-allocate-p (awhen (sb!c::node-lvar node)
+ (sb!c::lvar-dynamic-extent it))))
+ (maybe-pseudo-atomic stack-allocate-p
+ ;; FIXME: It would be good to check for stack overflow here.
+ (allocation result result node stack-allocate-p)
+ (inst lea result (make-ea :byte :base result :disp other-pointer-lowtag))
+ (storew type result 0 other-pointer-lowtag)
+ (storew length result vector-length-slot other-pointer-lowtag)))))
(define-vop (allocate-code-object)
(:args (boxed-arg :scs (any-reg) :target boxed)
;;; 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".)
-"0.8.21.45"
+"0.8.21.46"