[commit: ghc] : Garbage collect when determining stateAbsVars since we stopped doing it in reduceForMatch (f62af23)

Max Bolingbroke <[email protected]>
Newsgroups gmane.comp.lang.haskell.cvs.ghc
Message-ID <[email protected]>
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : 

http://hackage.haskell.org/trac/ghc/changeset/f62af232b59c5d58363f0d8ff5d51b73b12baa51

>---------------------------------------------------------------

commit f62af232b59c5d58363f0d8ff5d51b73b12baa51
Author: Max Bolingbroke <[email protected]>
Date:   Thu Mar 15 10:28:46 2012 +0000

    Garbage collect when determining stateAbsVars since we stopped doing it in reduceForMatch

>---------------------------------------------------------------

 .../supercompile/Supercompile/Drive/Process3.hs    |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/compiler/supercompile/Supercompile/Drive/Process3.hs b/compiler/supercompile/Supercompile/Drive/Process3.hs
index d343ea9..aa6a375 100644
--- a/compiler/supercompile/Supercompile/Drive/Process3.hs
+++ b/compiler/supercompile/Supercompile/Drive/Process3.hs
@@ -84,7 +84,13 @@ data MemoState = MS {
 
 promise :: MemoState -> (State, State) -> (MemoState, Promise)
 promise ms (state, reduced_state) = (ms', p)
-  where (vs_list, h_ty) = stateAbsVars (Just (stateLambdaBounders reduced_state)) state
+  where -- NB: because we stopped garbage-collecting in reduceForMatch, we need to garbage
+        -- collect here to ensure we mark as dead any lambda binders we won't be able to
+        -- determine a renaming for because they are dead.
+        --
+        -- If we don't do this then renameAbsVar will panic when it tries to lookup the renamed
+        -- version of a live variable.
+        (vs_list, h_ty) = stateAbsVars (Just (stateLambdaBounders (gc reduced_state))) state
         h_name :< h_names' = hNames ms
         x = mkLocalId h_name h_ty
         p = P {
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.