From 746675f027ef1c023ccd3ca5691206d748dde3ba Mon Sep 17 00:00:00 2001 From: ram <ram> Date: Sat, 18 Apr 1992 12:06:57 +0000 Subject: [PATCH] Backed out of the last change and tried another cut. We maintain the invariant that :LET lambdas always have a combination and bind node. We fix the problem we were running into by being more careful about deleting LETs when we see a combination, since the REF for the combination might have already been deleted. We might have been the 2n'd to last ref. --- compiler/ir1util.lisp | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/compiler/ir1util.lisp b/compiler/ir1util.lisp index 543c2c83c..1ecf115a5 100644 --- a/compiler/ir1util.lisp +++ b/compiler/ir1util.lisp @@ -7,7 +7,7 @@ ;;; Scott Fahlman or slisp-group@cs.cmu.edu. ;;; (ext:file-comment - "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/ir1util.lisp,v 1.53 1992/04/09 20:06:52 ram Exp $") + "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/ir1util.lisp,v 1.54 1992/04/18 12:06:57 ram Exp $") ;;; ;;; ********************************************************************** ;;; @@ -1046,12 +1046,32 @@ (do-nodes (node cont block) (typecase node (ref (delete-ref node)) + (cif + (flush-dest (if-test node))) + ;; + ;; The next two cases serve to maintain the invariant that a LET always + ;; has a well-formed COMBINATION, REF and BIND. We delete the lambda + ;; whenever we delete any of these, but we must be careful that this LET + ;; has not already been partially deleted. (basic-combination + (when (and (eq (basic-combination-kind node) :local) + ;; Guards COMBINATION-LAMBDA agains the REF being deleted. + (continuation-use (basic-combination-fun node))) + (let ((fun (combination-lambda node))) + ;; If our REF was the 2'nd to last ref, and has been deleted, then + ;; Fun may be a LET for some other combination. + (when (and (member (functional-kind fun) '(:let :mv-let)) + (eq (let-combination fun) node)) + (delete-lambda fun)))) (flush-dest (basic-combination-fun node)) (dolist (arg (basic-combination-args node)) (when arg (flush-dest arg)))) - (cif - (flush-dest (if-test node))) + (bind + (let ((lambda (bind-lambda node))) + (unless (eq (functional-kind lambda) :deleted) + (assert (member (functional-kind lambda) + '(:let :mv-let :assignment))) + (delete-lambda lambda)))) (exit (let ((value (exit-value node)) (entry (exit-entry node))) -- GitLab