1.0.44.7: ir1: Set LAMBDA-VAR-EXPLICIT-VALUE-CELL where possible.
authorAlastair Bridgewater <lisphacker@users.sourceforge.net>
Tue, 9 Nov 2010 19:43:30 +0000 (19:43 +0000)
committerAlastair Bridgewater <lisphacker@users.sourceforge.net>
Tue, 9 Nov 2010 19:43:30 +0000 (19:43 +0000)
  * Add a new stage to PHYSENVANAL, after tail-annotation to
fix up indirect (wanting value-cell) LAMBDA-VARs.

  * For each non-dynamic-extent CLAMBDA in the component,
mark all of the LAMBDA-VARs as needing an explicit value cell.

  * This analysis is correct as far as it goes, but it turns
out that marking CLAMBDAs as being dynamic-extent isn't done
in several cases that one would naively expect it to, thus
defeating most of the point of this analysis.

src/compiler/physenvanal.lisp
version.lisp-expr

index 2c6d8f6..fe6769c 100644 (file)
@@ -41,6 +41,7 @@
   (recheck-dynamic-extent-lvars component)
   (find-cleanup-points component)
   (tail-annotate component)
+  (analyze-indirect-lambda-vars component)
 
   (dolist (fun (component-lambdas component))
     (when (null (leaf-refs fun))
                                 (flood (get-node-physenv ref))))))))))
       (flood ref-physenv)))
   (values))
+
+;;; Find LAMBDA-VARs that are marked as needing to support indirect
+;;; access (SET at some point after initial creation) that are present
+;;; in CLAMBDAs not marked as being DYNAMIC-EXTENT (meaning that the
+;;; value-cell involved must be able to survive past the extent of the
+;;; allocating frame), and mark them (the LAMBDA-VARs) as needing
+;;; explicit value-cells.  Because they are already closed-over, the
+;;; LAMBDA-VARs already appear in the closures of all of the CLAMBDAs
+;;; that need checking.
+(defun analyze-indirect-lambda-vars (component)
+  (dolist (fun (component-lambdas component))
+    (unless (leaf-dynamic-extent fun)
+      (let ((closure (physenv-closure (lambda-physenv fun))))
+        (dolist (var closure)
+          (when (and (lambda-var-p var)
+                     (lambda-var-indirect var))
+            (setf (lambda-var-explicit-value-cell var) t)))))))
 \f
 ;;;; non-local exit
 
index 8e50bdf..4f005d9 100644 (file)
@@ -17,4 +17,4 @@
 ;;; 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.44.6"
+"1.0.44.7"