summaryrefslogtreecommitdiff
path: root/rts/sm/GC.c
diff options
context:
space:
mode:
authorSimon Marlow <simonmarhaskell@gmail.com>2008-04-16 23:28:25 +0000
committerSimon Marlow <simonmarhaskell@gmail.com>2008-04-16 23:28:25 +0000
commit49780c2e25cfbe821d585c5a31cb95aa49f41f14 (patch)
treea7ae4d2b1536e4b745b0a35c3a8c002b603e275b /rts/sm/GC.c
parent4ba3cb054c3f069520f8db26591eae27560638c9 (diff)
downloadhaskell-49780c2e25cfbe821d585c5a31cb95aa49f41f14.tar.gz
rearrange: we were calling markSomeCapabilities too often
Diffstat (limited to 'rts/sm/GC.c')
-rw-r--r--rts/sm/GC.c39
1 files changed, 22 insertions, 17 deletions
diff --git a/rts/sm/GC.c b/rts/sm/GC.c
index b381e56cce..978b7a0a20 100644
--- a/rts/sm/GC.c
+++ b/rts/sm/GC.c
@@ -144,7 +144,7 @@ static void update_task_list (void);
static void resize_generations (void);
static void resize_nursery (void);
static void start_gc_threads (void);
-static void gc_thread_work (void);
+static void scavenge_until_all_done (void);
static nat inc_running (void);
static nat dec_running (void);
static void wakeup_gc_threads (nat n_threads);
@@ -350,7 +350,7 @@ GarbageCollect ( rtsBool force_major_gc )
*/
for (;;)
{
- gc_thread_work();
+ scavenge_until_all_done();
// The other threads are now stopped. We might recurse back to
// here, but from now on this is the only thread.
@@ -883,26 +883,13 @@ dec_running (void)
return n_running;
}
-//
-// gc_thread_work(): Scavenge until there's no work left to do and all
-// the running threads are idle.
-//
static void
-gc_thread_work (void)
+scavenge_until_all_done (void)
{
nat r;
debugTrace(DEBUG_gc, "GC thread %d working", gct->thread_index);
- // gc_running_threads has already been incremented for us; either
- // this is the main thread and we incremented it inside
- // GarbageCollect(), or this is a worker thread and the main
- // thread bumped gc_running_threads before waking us up.
-
- // Every thread evacuates some roots.
- gct->evac_step = 0;
- markSomeCapabilities(mark_root, gct, gct->thread_index, n_gc_threads);
-
loop:
scavenge_loop();
// scavenge_loop() only exits when there's no work to do
@@ -927,8 +914,26 @@ loop:
debugTrace(DEBUG_gc, "GC thread %d finished.", gct->thread_index);
}
-
#if defined(THREADED_RTS)
+//
+// gc_thread_work(): Scavenge until there's no work left to do and all
+// the running threads are idle.
+//
+static void
+gc_thread_work (void)
+{
+ // gc_running_threads has already been incremented for us; this is
+ // a worker thread and the main thread bumped gc_running_threads
+ // before waking us up.
+
+ // Every thread evacuates some roots.
+ gct->evac_step = 0;
+ markSomeCapabilities(mark_root, gct, gct->thread_index, n_gc_threads);
+
+ scavenge_until_all_done();
+}
+
+
static void
gc_thread_mainloop (void)
{