X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fcompiler%2Fgtn.lisp;h=af808d28f2c605a7567c60a4b99c144b59d52616;hb=74cf7a4d01664fbf72a662ba093ad67ca243b524;hp=2752accd211eda8bbd3d6ca9d9b1d0472a6bc75f;hpb=578d987735906eb05829f0c2235a3ba9225c2bc4;p=sbcl.git diff --git a/src/compiler/gtn.lisp b/src/compiler/gtn.lisp index 2752acc..af808d2 100644 --- a/src/compiler/gtn.lisp +++ b/src/compiler/gtn.lisp @@ -40,16 +40,35 @@ (declare (type clambda fun)) (dolist (var (lambda-vars fun)) (when (leaf-refs var) - (let* ((type (if (lambda-var-indirect var) - *backend-t-primitive-type* + (let* (ptype-info + (type (if (lambda-var-indirect var) + (if (lambda-var-explicit-value-cell var) + *backend-t-primitive-type* + (or (first + (setf ptype-info + (primitive-type-indirect-cell-type + (primitive-type (leaf-type var))))) + *backend-t-primitive-type*)) (primitive-type (leaf-type var)))) - (temp (make-normal-tn type)) + (res (make-normal-tn type)) (node (lambda-bind fun)) - (res (if (or (and let-p (policy node (< debug 3))) - (policy node (zerop debug)) - (policy node (= speed 3))) - temp - (physenv-debug-live-tn temp (lambda-physenv fun))))) + (debug-variable-p (not (or (and let-p (policy node (< debug 3))) + (policy node (zerop debug)) + (policy node (= speed 3)))))) + (cond + ((and (lambda-var-indirect var) + (not (lambda-var-explicit-value-cell var))) + ;; Force closed-over indirect LAMBDA-VARs without explicit + ;; VALUE-CELLs to the stack, and make sure that they are + ;; live over the dynamic contour of the physenv. + (setf (tn-sc res) (if ptype-info + (second ptype-info) + (sc-or-lose 'sb!vm::control-stack))) + (physenv-live-tn res (lambda-physenv fun))) + + (debug-variable-p + (physenv-debug-live-tn res (lambda-physenv fun)))) + (setf (tn-leaf res) var) (setf (leaf-info var) res)))) (values))