From fb26039e896a6d89f86274b714f5be25b5fc8603 Mon Sep 17 00:00:00 2001 From: Alastair Bridgewater Date: Tue, 9 Nov 2010 19:43:30 +0000 Subject: [PATCH] 1.0.44.7: ir1: Set LAMBDA-VAR-EXPLICIT-VALUE-CELL where possible. * 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 | 18 ++++++++++++++++++ version.lisp-expr | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/compiler/physenvanal.lisp b/src/compiler/physenvanal.lisp index 2c6d8f6..fe6769c 100644 --- a/src/compiler/physenvanal.lisp +++ b/src/compiler/physenvanal.lisp @@ -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)) @@ -207,6 +208,23 @@ (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))))))) ;;;; non-local exit diff --git a/version.lisp-expr b/version.lisp-expr index 8e50bdf..4f005d9 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -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" -- 1.7.10.4