summaryrefslogtreecommitdiff
path: root/rts/sm/GC.c
diff options
context:
space:
mode:
Diffstat (limited to 'rts/sm/GC.c')
-rw-r--r--rts/sm/GC.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/rts/sm/GC.c b/rts/sm/GC.c
index 51eab4e2be..9f69a4c65a 100644
--- a/rts/sm/GC.c
+++ b/rts/sm/GC.c
@@ -177,11 +177,15 @@ GarbageCollect (rtsBool force_major_gc,
bdescr *bd;
generation *gen;
lnat live_blocks, live_words, allocated, max_copied, avg_copied;
+#if defined(THREADED_RTS)
gc_thread *saved_gct;
+#endif
nat g, n;
// necessary if we stole a callee-saves register for gct:
+#if defined(THREADED_RTS)
saved_gct = gct;
+#endif
#ifdef PROFILING
CostCentreStack *prev_CCS;
@@ -956,7 +960,7 @@ any_work (void)
static void
scavenge_until_all_done (void)
{
- nat r;
+ DEBUG_ONLY( nat r );
loop:
@@ -973,8 +977,13 @@ loop:
collect_gct_blocks();
// scavenge_loop() only exits when there's no work to do
+
+#ifdef DEBUG
r = dec_running();
-
+#else
+ dec_running();
+#endif
+
traceEventGcIdle(gct->cap);
debugTrace(DEBUG_gc, "%d GC threads still running", r);
@@ -1400,8 +1409,10 @@ mark_root(void *user USED_IF_THREADS, StgClosure **root)
// so we need to save and restore it here. NB. only call
// mark_root() from the main GC thread, otherwise gct will be
// incorrect.
+#if defined(THREADED_RTS)
gc_thread *saved_gct;
saved_gct = gct;
+#endif
SET_GCT(user);
evacuate(root);