/* -----------------------------------------------------------------------------
- * $Id: GC.c,v 1.79 2000/04/14 15:18:06 sewardj Exp $
+ * $Id: GC.c,v 1.86 2000/11/01 11:41:47 simonmar Exp $
*
* (c) The GHC Team 1998-1999
*
# include "ParallelDebug.h"
# endif
#endif
+#if defined(GHCI)
+# include "HsFFI.h"
+# include "Linker.h"
+#endif
+#if defined(RTS_GTK_FRONTPANEL)
+#include "FrontPanel.h"
+#endif
//@node STATIC OBJECT LIST, Static function declarations, Includes
//@subsection STATIC OBJECT LIST
*/
bdescr *old_to_space;
-
/* Data used for allocation area sizing.
*/
lnat new_blocks; /* blocks allocated during this GC */
static StgClosure * evacuate ( StgClosure *q );
static void zero_static_object_list ( StgClosure* first_static );
static void zero_mutable_list ( StgMutClosure *first );
-static void revert_dead_CAFs ( void );
static rtsBool traverse_weak_ptr_list ( void );
static void cleanup_weak_ptr_list ( StgWeak **list );
CCCS = CCS_GC;
#endif
- /* Approximate how much we allocated */
+ /* Approximate how much we allocated.
+ * Todo: only when generating stats?
+ */
allocated = calcAllocated();
/* Figure out which generation to collect
major_gc = (N == RtsFlags.GcFlags.generations-1);
}
+#ifdef RTS_GTK_FRONTPANEL
+ if (RtsFlags.GcFlags.frontpanel) {
+ updateFrontPanelBeforeGC(N);
+ }
+#endif
+
/* check stack sanity *before* GC (ToDo: check all threads) */
#if defined(GRAN)
// ToDo!: check sanity IF_DEBUG(sanity, checkTSOsSanity());
*/
gcStablePtrTable(major_gc);
-#if 0
- /* revert dead CAFs and update enteredCAFs list */
- revert_dead_CAFs();
-#endif
-
#if defined(PAR)
/* Reconstruct the Global Address tables used in GUM */
rebuildGAtables(major_gc);
/* check for memory leaks if sanity checking is on */
IF_DEBUG(sanity, memInventory());
+#ifdef RTS_GTK_VISUALS
+ if (RtsFlags.GcFlags.visuals) {
+ updateFrontPanelAfterGC( N, live );
+ }
+#endif
+
/* ok, GC over: tell the stats department what happened. */
stat_endGC(allocated, collected, live, copied, N);
}
* the list.
*/
switch (t->what_next) {
+ case ThreadRelocated:
+ next = t->link;
+ *prev = next;
+ continue;
case ThreadKilled:
case ThreadComplete:
- next = t->global_link;
- *prev = next;
- continue;
+ next = t->global_link;
+ *prev = next;
+ continue;
default:
}
selectee = ((StgEvacuated *)selectee)->evacuee;
goto selector_loop;
+ case AP_UPD:
case THUNK:
case THUNK_1_0:
case THUNK_0_1:
/* relocate the stack pointers... */
new_tso->su = (StgUpdateFrame *) ((StgPtr)new_tso->su + diff);
new_tso->sp = (StgPtr)new_tso->sp + diff;
- new_tso->splim = (StgPtr)new_tso->splim + diff;
relocate_TSO(tso, new_tso);
#endif
}
-#if 0
-//@cindex revert_dead_CAFs
-
-void revert_dead_CAFs(void)
-{
- StgCAF* caf = enteredCAFs;
- enteredCAFs = END_CAF_LIST;
- while (caf != END_CAF_LIST) {
- StgCAF *next, *new;
- next = caf->link;
- new = (StgCAF*)isAlive((StgClosure*)caf);
- if (new) {
- new->link = enteredCAFs;
- enteredCAFs = new;
- } else {
- /* ASSERT(0); */
- SET_INFO(caf,&CAF_UNENTERED_info);
- caf->value = (StgClosure*)0xdeadbeef;
- caf->link = (StgCAF*)0xdeadbeef;
- }
- caf = next;
- }
-}
-#endif
-
//@node Sanity code for CAF garbage collection, Lazy black holing, Reverting CAFs
//@subsection Sanity code for CAF garbage collection
//* printMutOnceList:: @cindex\s-+printMutOnceList
//* printMutableList:: @cindex\s-+printMutableList
//* relocate_TSO:: @cindex\s-+relocate_TSO
-//* revert_dead_CAFs:: @cindex\s-+revert_dead_CAFs
//* scavenge:: @cindex\s-+scavenge
//* scavenge_large:: @cindex\s-+scavenge_large
//* scavenge_mut_once_list:: @cindex\s-+scavenge_mut_once_list