From 681aba64d5f81ab6b44978c013c01a952fd7696c Mon Sep 17 00:00:00 2001
From: simonm <unknown>
Date: Thu, 14 Jan 1999 11:11:29 +0000
Subject: [PATCH] [project @ 1999-01-14 11:11:29 by simonm] - check
 failed_to_evac in scavenge_static.  We might have a static   indirection
 (i.e. a CAF) that we can't evacuate to the oldest generation,   so we have to
 put it back on the old generation mutable list.

With this change, a bootstrapped compiler now compiles the libraries
successfully.
---
 ghc/rts/GC.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/ghc/rts/GC.c b/ghc/rts/GC.c
index 695e132b0c3f..741c46629bbe 100644
--- a/ghc/rts/GC.c
+++ b/ghc/rts/GC.c
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: GC.c,v 1.7 1999/01/14 10:49:01 simonm Exp $
+ * $Id: GC.c,v 1.8 1999/01/14 11:11:29 simonm Exp $
  *
  * Two-space garbage collector
  *
@@ -1745,6 +1745,18 @@ scavenge_static(void)
       {
 	StgInd *ind = (StgInd *)p;
 	ind->indirectee = evacuate(ind->indirectee);
+
+	/* might fail to evacuate it, in which case we have to pop it
+	 * back on the mutable list (and take it off the
+	 * scavenged_static list because the static link and mut link
+	 * pointers are one and the same).
+	 */
+	if (failed_to_evac) {
+	  failed_to_evac = rtsFalse;
+	  scavenged_static_objects = STATIC_LINK(info,p);
+	  ((StgMutClosure *)ind)->mut_link = oldest_gen->mut_list;
+	  oldest_gen->mut_list = (StgMutClosure *)ind;
+	}
 	break;
       }
       
@@ -1769,6 +1781,8 @@ scavenge_static(void)
       barf("scavenge_static");
     }
 
+    ASSERT(failed_to_evac == rtsFalse);
+
     /* get the next static object from the list.  Remeber, there might
      * be more stuff on this list now that we've done some evacuating!
      * (static_objects is a global)
-- 
GitLab