[project @ 2001-10-19 09:41:11 by sewardj]
authorsewardj <unknown>
Fri, 19 Oct 2001 09:41:11 +0000 (09:41 +0000)
committersewardj <unknown>
Fri, 19 Oct 2001 09:41:11 +0000 (09:41 +0000)
merge from stable revs:
  1.121.4.1 +7 -6      fptools/ghc/rts/GC.c
  1.9.4.1   +4 -1      fptools/ghc/rts/GCCompact.c
  1.17.4.1  +4 -3      fptools/ghc/rts/StoragePriv.h

  SimonM's fixes to deal with GHCi and CAFs properly in the compacting
  collector.

ghc/rts/GC.c
ghc/rts/GCCompact.c
ghc/rts/StoragePriv.h

index 1f42fc4..16712d4 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: GC.c,v 1.124 2001/10/17 15:19:24 simonmar Exp $
+ * $Id: GC.c,v 1.125 2001/10/19 09:41:11 sewardj Exp $
  *
  * (c) The GHC Team 1998-1999
  *
@@ -142,7 +142,6 @@ static void         scavenge_large          ( step * );
 static void         scavenge_static         ( void );
 static void         scavenge_mutable_list   ( generation *g );
 static void         scavenge_mut_once_list  ( generation *g );
-static void         scavengeCAFs            ( void );
 
 #if 0 && defined(DEBUG)
 static void         gcCAFs                  ( void );
@@ -462,7 +461,10 @@ GarbageCollect ( void (*get_roots)(evac_fn), rtsBool force_major_gc )
     }
   }
 
-  scavengeCAFs();
+  /* follow roots from the CAF list (used by GHCi)
+   */
+  evac_gen = 0;
+  markCAFs(mark_root);
 
   /* follow all the roots that the application knows about.
    */
@@ -3473,15 +3475,14 @@ revertCAFs( void )
 }
 
 void
-scavengeCAFs( void )
+markCAFs( evac_fn evac )
 {
     StgIndStatic *c;
 
-    evac_gen = 0;
     for (c = (StgIndStatic *)caf_list; c != NULL; 
         c = (StgIndStatic *)c->static_link) 
     {
-       c->indirectee = evacuate(c->indirectee);
+       evac(&c->indirectee);
     }
 }
 
index 3254ba6..70937f6 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: GCCompact.c,v 1.9 2001/08/14 13:40:09 sewardj Exp $
+ * $Id: GCCompact.c,v 1.10 2001/10/19 09:41:11 sewardj Exp $
  *
  * (c) The GHC Team 2001
  *
@@ -873,6 +873,9 @@ compact( void (*get_roots)(evac_fn) )
     // the stable pointer table
     threadStablePtrTable((evac_fn)thread);
 
+    // the CAF list (used by GHCi)
+    markCAFs((evac_fn)thread);
+
     // 2. update forward ptrs
     for (g = 0; g < RtsFlags.GcFlags.generations; g++) {
        for (s = 0; s < generations[g].n_steps; s++) {
index add78a4..0b0907f 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: StoragePriv.h,v 1.17 2001/08/08 10:50:37 simonmar Exp $
+ * $Id: StoragePriv.h,v 1.18 2001/10/19 09:41:11 sewardj Exp $
  *
  * (c) The GHC Team, 1998-1999
  *
@@ -91,7 +91,8 @@ int is_not_dynamically_loaded_ptr            ( void* p );
 
 /* Functions from GC.c 
  */
-void threadPaused(StgTSO *);
-StgClosure *isAlive(StgClosure *p);
+extern void         threadPaused ( StgTSO * );
+extern StgClosure * isAlive      ( StgClosure *p );
+extern void         markCAFs     ( evac_fn evac );
 
 #endif /* STORAGEPRIV_H */