419: stack-allocated indirect closure variables are not popped
- (locally (declare (optimize speed (safety 0)))
+ (locally (declare (optimize sb-c::stack-allocate-dynamic-extent
+ sb-c::stack-allocate-value-cells))
(defun bug419 (x)
(multiple-value-call #'list
(eval '(values 1 2 3))
(declare (dynamic-extent #'mget #'mset))
((lambda (f g) (eval `(progn ,f ,g (values 4 5 6)))) #'mget #'mset))))))
- (ASSERT (EQUAL (BUG419) '(1 2 3 4 5 6))) => failure
+ (ASSERT (EQUAL (BUG419 42) '(1 2 3 4 5 6))) => failure
+
+ Note: as of SBCL 1.0.26.29 this bug no longer affects user code, as
+ SB-C::STACK-ALLOCATE-VALUE-CELLS needs to be explicitly turned on for
+ that to happen. Proper fix for this bug requires (Nikodemus thinks)
+ storing the relevant LAMBDA-VARs in a :DYNAMIC-EXTENT cleanup, and
+ teaching stack analysis how to deal with them.
420: The MISC.556 test from gcl/ansi-tests/misc.lsp fails hard.
;;;; -*- coding: utf-8; -*-
changes in sbcl-1.0.17 relative to 1.0.16:
+ * temporary regression: user code can no longer allocate closure
+ variable storage on stack, due to bug 419 without explicitly
+ requesting it. Please consult sbcl-devel for advice if you need to
+ use this feature in the meanwhile.
* optimization: ADJOIN and PUSHNEW are upto ~70% faster in normal
SPEED policies.
* optimization: APPEND is upto ~10% faster in normal SPEED policies.
;; never insert stepper conditions
(sb!c:insert-step-conditions 0)
;; always stack-allocate if requested
- (sb!c::stack-allocate-dynamic-extent 3)))))
+ (sb!c::stack-allocate-dynamic-extent 3)
+ ;; ...even value cells!
+ (sb!c::stack-allocate-value-cells 3)))))
(compile 'proclaim-target-optimization)
(defun in-target-cross-compilation-mode (fun)
(defun emit-make-value-cell (node block value res)
(event make-value-cell-event node)
(let ((leaf (tn-leaf res)))
- (vop make-value-cell node block value (and leaf (leaf-dynamic-extent leaf))
+ (vop make-value-cell node block value
+ (and leaf (leaf-dynamic-extent leaf)
+ ;; FIXME: See bug 419
+ (policy node (> stack-allocate-value-cells 1)))
res)))
\f
;;;; leaf reference
"Control whether allocate objects, declared DYNAMIC-EXTENT, on
stack.")
+(define-optimization-quality stack-allocate-value-cells
+ ;; FIXME, see bug 419
+ 0
+ ("no" "maybe" "yes" "yes")
+ "Control whether allocate closure variable storage, declared
+DYNAMIC-EXTENT, on stack.")
+
(define-optimization-quality stack-allocate-vector
(cond ((= stack-allocate-dynamic-extent 0) 0)
((= safety 0) 3)
;;; value-cells
(defun-with-dx dx-value-cell (x)
+ (declare (optimize sb-c::stack-allocate-value-cells))
;; Not implemented everywhere, yet.
#+(or x86 x86-64 mips)
(let ((cell x))
(multiple-value-bind (i j) (let-converted-vars-dx-allocated-bug 1 2 3)
(assert (and (equal i j)
(equal i (list 1 2 3)))))
+
+;;; workaround for bug 419 -- real issue remains, but check that the
+;;; bandaid holds.
+(defun-with-dx bug419 (x)
+ (multiple-value-call #'list
+ (eval '(values 1 2 3))
+ (let ((x x))
+ (declare (dynamic-extent x))
+ (flet ((mget (y)
+ (+ x y))
+ (mset (z)
+ (incf x z)))
+ (declare (dynamic-extent #'mget #'mset))
+ ((lambda (f g) (eval `(progn ,f ,g (values 4 5 6)))) #'mget #'mset)))))
+(assert (equal (bug419 42) '(1 2 3 4 5 6)))
\f
;;; 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.16.28"
+"1.0.16.29"