(in-package "SB!VM")
\f
-;;;; LIST and LIST*
+;;;; CONS, LIST and LIST*
+(defoptimizer (cons stack-allocate-result) ((&rest args))
+ t)
(defoptimizer (list stack-allocate-result) ((&rest args))
(not (null args)))
(defoptimizer (list* stack-allocate-result) ((&rest args))
(:policy :fast-safe)
(:node-var node)
(:generator 100
- (let ((unboxed-elements-p (and (sc-is type immediate)
- (/= (tn-value type)
- simple-vector-widetag))))
- (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))
- ;; FIXME: It would be good to check for stack overflow here.
- (move ecx words)
- (inst shr ecx n-fixnum-tag-bits)
- (allocation result result node t)
- (unless unboxed-elements-p
- (inst cld))
- (inst lea res
- (make-ea :byte :base result :disp (* vector-data-offset n-word-bytes)))
- (inst lea result (make-ea :byte :base result :disp other-pointer-lowtag))
- (sc-case type
- (immediate
- (aver (typep (tn-value type) '(unsigned-byte 8)))
- (storeb (tn-value type) result 0 other-pointer-lowtag))
- (t
- (storew type result 0 other-pointer-lowtag)))
- (storew length result vector-length-slot other-pointer-lowtag)
- (unless unboxed-elements-p
- (inst xor zero zero)
- (inst rep)
- (inst stos zero)))))
+ (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))
+ ;; FIXME: It would be good to check for stack overflow here.
+ (move ecx words)
+ (inst shr ecx n-fixnum-tag-bits)
+ (allocation result result node t)
+ (inst cld)
+ (inst lea res
+ (make-ea :byte :base result :disp (* vector-data-offset n-word-bytes)))
+ (inst lea result (make-ea :byte :base result :disp other-pointer-lowtag))
+ (sc-case type
+ (immediate
+ (aver (typep (tn-value type) '(unsigned-byte 8)))
+ (storeb (tn-value type) result 0 other-pointer-lowtag))
+ (t
+ (storew type result 0 other-pointer-lowtag)))
+ (storew length result vector-length-slot other-pointer-lowtag)
+ (inst xor zero zero)
+ (inst rep)
+ (inst stos zero)))
(in-package "SB!C")
(define-vop (make-value-cell)
(:args (value :scs (descriptor-reg any-reg) :to :result))
(:results (result :scs (descriptor-reg) :from :eval))
+ (:info stack-allocate-p)
(:node-var node)
(:generator 10
(with-fixed-allocation
- (result value-cell-header-widetag value-cell-size node)
+ (result value-cell-header-widetag value-cell-size node stack-allocate-p)
(storew value result value-cell-value-slot other-pointer-lowtag))))
\f
;;;; automatic allocators for primitive objects
(define-vop (fixed-alloc)
(:args)
- (:info name words type lowtag)
+ (:info name words type lowtag stack-allocate-p)
(:ignore name)
(:results (result :scs (descriptor-reg)))
(:node-var node)
;; also check for (< SPEED SPACE) is because we want the space
;; savings that these out-of-line allocation routines bring whilst
;; compiling SBCL itself. --njf, 2006-07-08
- (if (and (= lowtag list-pointer-lowtag) (policy node (< speed 3)))
+ (if (and (not stack-allocate-p)
+ (= lowtag list-pointer-lowtag) (policy node (< speed 3)))
(let ((dst
+ ;; FIXME: out-of-line dx-allocation
#.(loop for offset in *dword-regs*
collect `(,offset
',(intern (format nil "ALLOCATE-CONS-TO-~A"
,@cases)))))
(aver (null type))
(inst call (make-fixup dst :assembly-routine)))
- (pseudo-atomic
- (allocation result (pad-data-block words) node)
+ (maybe-pseudo-atomic stack-allocate-p
+ (allocation result (pad-data-block words) node stack-allocate-p)
(inst lea result (make-ea :byte :base result :disp lowtag))
(when type
(storew (logior (ash (1- words) n-widetag-bits) type)