From 36122c8b031dafb1dcd8ee7e986e67f5c79723f0 Mon Sep 17 00:00:00 2001 From: William Harold Newman Date: Tue, 4 Dec 2001 17:50:00 +0000 Subject: [PATCH] 0.pre7.86.flaky7.19: (bootstraps itself and gets through many regression tests, but dies in clocc-ansi-test :SECTION5-LEGACY-699) The obvious version of scavenging closure-over relationships still wanders into deleted lambdas, and when I stop it from wandering into deleted lambdas, the compiler fails in UNCONVERT-TAIL-CALLS when cross-compiling pprint.lisp. The problem is that a CONTINUATION-DEST is NIL when UNCONVERT-TAIL-CALLS is expecting it to be a NODE. So I looked at the description of DEST in DEFSTRUCT CONTINUATION, and looking at the way that the CONTINUATION-DEST is used in UNCONVERT-TAIL-CALLS and... ...made UNCONVERT-TAIL-CALLS handle null values of THIS-CALL (treating them as "can't possibly be one of the matches that I'm looking for") --- src/compiler/dfo.lisp | 19 +++++++++++++++---- src/compiler/locall.lisp | 3 ++- version.lisp-expr | 2 +- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/compiler/dfo.lisp b/src/compiler/dfo.lisp index 325bdfa..68469c8 100644 --- a/src/compiler/dfo.lisp +++ b/src/compiler/dfo.lisp @@ -263,13 +263,24 @@ (dolist (call calls) (let ((call-home (lambda-home call))) (setf res (dfo-scavenge-dependency-graph call-home res))))) - ;; TO DO: Scavenge closure-over relationships. - (values) + ;; Scavenge closure-over relationships: if FUN refers to a + ;; variable whose home lambda is not FUN, then the home lambda + ;; should be in the same component as FUN. (sbcl-0.6.13, and + ;; CMU CL, didn't do this, leading to the occasional failure + ;; when physenv analysis, which is local to each component, + ;; would bogusly conclude that a closed-over variable was + ;; unused and thus delete it. See e.g. cmucl-imp 2001-11-29.) + (dolist (var (lambda-refers-to-vars clambda)) + (unless (null (lambda-var-refs var)) ; i.e. unless deleted + (let ((var-home-home (lambda-home (lambda-var-home var)))) + (unless (eql (lambda-kind var-home-home) :deleted) + (setf res + (dfo-scavenge-dependency-graph var-home-home res)))))) ;; Voila. res))))) -;;; Return true if CLAMBDA either is an XEP or has EXITS to some of its -;;; ENTRIES. +;;; Return true if CLAMBDA either is an XEP or has EXITS to some of +;;; its ENTRIES. (defun has-xep-or-nlx (clambda) (declare (type clambda clambda)) (or (eq (functional-kind clambda) :external) diff --git a/src/compiler/locall.lisp b/src/compiler/locall.lisp index 8cab2c5..d031161 100644 --- a/src/compiler/locall.lisp +++ b/src/compiler/locall.lisp @@ -861,7 +861,8 @@ (dolist (called (lambda-calls fun)) (dolist (ref (leaf-refs called)) (let ((this-call (continuation-dest (node-cont ref)))) - (when (and (node-tail-p this-call) + (when (and this-call + (node-tail-p this-call) (eq (node-home-lambda this-call) fun)) (setf (node-tail-p this-call) nil) (ecase (functional-kind called) diff --git a/version.lisp-expr b/version.lisp-expr index f924f19..e45fbb1 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -18,4 +18,4 @@ ;;; for internal versions, especially for internal versions off the ;;; main CVS branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"0.pre7.86.flaky7.18" +"0.pre7.86.flaky7.19" -- 1.7.10.4