summaryrefslogtreecommitdiff
path: root/rts/sm
diff options
context:
space:
mode:
authorSimon Marlow <simonmarhaskell@gmail.com>2008-04-16 21:51:09 +0000
committerSimon Marlow <simonmarhaskell@gmail.com>2008-04-16 21:51:09 +0000
commit0b0842005c6c68f5f0d7ab428eb153e5a47334d1 (patch)
tree46ba9c7e57be0f21428eeb9b73ccfb388b0c2dc6 /rts/sm
parent4c394999264d602f10e7623cefa7588423c4f68b (diff)
downloadhaskell-0b0842005c6c68f5f0d7ab428eb153e5a47334d1.tar.gz
treat the global work list as a queue rather than a stack
Diffstat (limited to 'rts/sm')
-rw-r--r--rts/sm/GC.c1
-rw-r--r--rts/sm/GCUtils.c12
2 files changed, 11 insertions, 2 deletions
diff --git a/rts/sm/GC.c b/rts/sm/GC.c
index 5b166943d7..934c91f2eb 100644
--- a/rts/sm/GC.c
+++ b/rts/sm/GC.c
@@ -1197,6 +1197,7 @@ init_collected_gen (nat g, nat n_threads)
// we don't have any to-be-scavenged blocks yet
stp->todos = NULL;
+ stp->todos_last = NULL;
stp->n_todos = 0;
// initialise the large object queues.
diff --git a/rts/sm/GCUtils.c b/rts/sm/GCUtils.c
index 636f23dc23..b400744290 100644
--- a/rts/sm/GCUtils.c
+++ b/rts/sm/GCUtils.c
@@ -65,6 +65,9 @@ grab_todo_block (step_workspace *ws)
ACQUIRE_SPIN_LOCK(&stp->sync_todo);
if (stp->todos) {
bd = stp->todos;
+ if (stp->todos == stp->todos_last) {
+ stp->todos_last = NULL;
+ }
stp->todos = bd->link;
stp->n_todos--;
bd->link = NULL;
@@ -78,8 +81,13 @@ push_todo_block (bdescr *bd, step *stp)
{
ASSERT(bd->link == NULL);
ACQUIRE_SPIN_LOCK(&stp->sync_todo);
- bd->link = stp->todos;
- stp->todos = bd;
+ if (stp->todos_last == NULL) {
+ stp->todos_last = bd;
+ stp->todos = bd;
+ } else {
+ stp->todos_last->link = bd;
+ stp->todos_last = bd;
+ }
stp->n_todos++;
trace(TRACE_gc, "step %d, n_todos: %d", stp->abs_no, stp->n_todos);
RELEASE_SPIN_LOCK(&stp->sync_todo);