summaryrefslogtreecommitdiff
path: root/rts/sm/GC.c
diff options
context:
space:
mode:
authorSimon Marlow <simonmarhaskell@gmail.com>2008-04-16 23:44:20 +0000
committerSimon Marlow <simonmarhaskell@gmail.com>2008-04-16 23:44:20 +0000
commit200c73fdfea734765c48309cc8dcbcf44b69c8c5 (patch)
tree3c2368de05e5050dede56981076c7a9bbfcea457 /rts/sm/GC.c
parent233a468745d108ea845e0898e4177df2c3734fc0 (diff)
downloadhaskell-200c73fdfea734765c48309cc8dcbcf44b69c8c5.tar.gz
Don't traverse the entire list of threads on every GC (phase 1)
Instead of keeping a single list of all threads, keep one per step and only look at the threads belonging to steps that we are collecting.
Diffstat (limited to 'rts/sm/GC.c')
-rw-r--r--rts/sm/GC.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/rts/sm/GC.c b/rts/sm/GC.c
index f869ec4151..3cb71fa7f8 100644
--- a/rts/sm/GC.c
+++ b/rts/sm/GC.c
@@ -1078,14 +1078,19 @@ init_collected_gen (nat g, nat n_threads)
for (s = 0; s < generations[g].n_steps; s++) {
+ stp = &generations[g].steps[s];
+ ASSERT(stp->gen_no == g);
+
+ // we'll construct a new list of threads in this step
+ // during GC, throw away the current list.
+ stp->old_threads = stp->threads;
+ stp->threads = END_TSO_QUEUE;
+
// generation 0, step 0 doesn't need to-space
if (g == 0 && s == 0 && RtsFlags.GcFlags.generations > 1) {
continue;
}
- stp = &generations[g].steps[s];
- ASSERT(stp->gen_no == g);
-
// deprecate the existing blocks
stp->old_blocks = stp->blocks;
stp->n_old_blocks = stp->n_blocks;