summaryrefslogtreecommitdiff
path: root/rts/sm
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2009-04-03 08:37:08 +0000
committerSimon Marlow <marlowsd@gmail.com>2009-04-03 08:37:08 +0000
commitc36ca010c5f7e019c9dd4d122be5c22905777e38 (patch)
tree5dd14acfdfdc5b5d27287d345e9f3fcd367700f5 /rts/sm
parent11ca89b8a5ce9ce1c2d3959361e05efd9170887e (diff)
downloadhaskell-c36ca010c5f7e019c9dd4d122be5c22905777e38.tar.gz
small GC optimisation
Diffstat (limited to 'rts/sm')
-rw-r--r--rts/sm/Evac.c4
-rw-r--r--rts/sm/GCUtils.c13
2 files changed, 13 insertions, 4 deletions
diff --git a/rts/sm/Evac.c b/rts/sm/Evac.c
index 6325a12f9c..5935f9069e 100644
--- a/rts/sm/Evac.c
+++ b/rts/sm/Evac.c
@@ -74,10 +74,10 @@ alloc_for_copy (nat size, step *stp)
* necessary.
*/
to = ws->todo_free;
- if (to + size > ws->todo_lim) {
+ ws->todo_free += size;
+ if (ws->todo_free > ws->todo_lim) {
to = todo_block_full(size, ws);
}
- ws->todo_free = to + size;
ASSERT(ws->todo_free >= ws->todo_bd->free && ws->todo_free <= ws->todo_lim);
return to;
diff --git a/rts/sm/GCUtils.c b/rts/sm/GCUtils.c
index 86d2282980..57cede7d43 100644
--- a/rts/sm/GCUtils.c
+++ b/rts/sm/GCUtils.c
@@ -149,8 +149,13 @@ push_scanned_block (bdescr *bd, step_workspace *ws)
StgPtr
todo_block_full (nat size, step_workspace *ws)
{
+ StgPtr p;
bdescr *bd;
+ // todo_free has been pre-incremented by Evac.c:alloc_for_copy(). We
+ // are expected to leave it bumped when we've finished here.
+ ws->todo_free -= size;
+
bd = ws->todo_bd;
ASSERT(bd != NULL);
@@ -167,7 +172,9 @@ todo_block_full (nat size, step_workspace *ws)
ws->todo_lim = stg_min(bd->start + BLOCK_SIZE_W,
ws->todo_lim + stg_max(WORK_UNIT_WORDS,size));
debugTrace(DEBUG_gc, "increasing limit for %p to %p", bd->start, ws->todo_lim);
- return ws->todo_free;
+ p = ws->todo_free;
+ ws->todo_free += size;
+ return p;
}
}
@@ -212,7 +219,9 @@ todo_block_full (nat size, step_workspace *ws)
alloc_todo_block(ws, size);
- return ws->todo_free;
+ p = ws->todo_free;
+ ws->todo_free += size;
+ return p;
}
StgPtr