From f0634e3301c025e34ff3a446b5b2f116e91a6f1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Kochma=C5=84ski?= Date: Wed, 15 Nov 2023 15:06:56 +0100 Subject: [PATCH] cmp: remove invalid optimization from unwind-exit The optimization assumed, that we don't need to unwind stacks when there are no bds nor stack frame changes. That leads to a corrupted IHS environment among other things. --- src/cmp/cmpbackend-cxx/cmppass2-exit.lsp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/cmp/cmpbackend-cxx/cmppass2-exit.lsp b/src/cmp/cmpbackend-cxx/cmppass2-exit.lsp index 45112c249..ad9882199 100644 --- a/src/cmp/cmpbackend-cxx/cmppass2-exit.lsp +++ b/src/cmp/cmpbackend-cxx/cmppass2-exit.lsp @@ -130,11 +130,10 @@ (or (eq (car *destination*) 'JUMP-TRUE) (eq (car *destination*) 'JUMP-FALSE))) (unwind-stacks frs-bind bds-lcl bds-bind stack-frame ihs-p)) - ((not (or (plusp frs-bind) bds-lcl (plusp bds-bind) stack-frame)) - (set-loc loc)) ;; Save the value if LOC may possibly refer to special binding. - ((or (loc-refers-to-special-p loc) - (loc-refers-to-special-p *destination*)) + ((and (or (plusp frs-bind) bds-lcl (plusp bds-bind) stack-frame) + (or (loc-refers-to-special-p loc) + (loc-refers-to-special-p *destination*))) (let* ((*temp* *temp*) (temp (make-temp-var))) (let ((*destination* temp))