summaryrefslogtreecommitdiff
path: root/rts/ThreadPaused.c
diff options
context:
space:
mode:
authorSimon Marlow <simonmar@microsoft.com>2008-02-07 12:24:45 +0000
committerSimon Marlow <simonmar@microsoft.com>2008-02-07 12:24:45 +0000
commit53a442f10d80cd85b33620a023c4a8749a7c0b20 (patch)
tree75013544887360621806ae1f07d1ef5128740182 /rts/ThreadPaused.c
parentb5a8dd88e3939cf547be50ab62bae84f5bf0398d (diff)
downloadhaskell-53a442f10d80cd85b33620a023c4a8749a7c0b20.tar.gz
Tweaks to stack squeezing
1. We weren't squeezing two frames if one of them was a marked update frame. This is easy to fix. 2. The heuristic to decide whether to squeeze was a little conservative. It's worth copying 3 words to save an update frame.
Diffstat (limited to 'rts/ThreadPaused.c')
-rw-r--r--rts/ThreadPaused.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/rts/ThreadPaused.c b/rts/ThreadPaused.c
index 5b64f76ff2..3aa66edc19 100644
--- a/rts/ThreadPaused.c
+++ b/rts/ThreadPaused.c
@@ -50,7 +50,7 @@ stackSqueeze(StgTSO *tso, StgPtr bottom)
current_gap_size = 0;
gap = (struct stack_gap *) (tso->sp - sizeofW(StgUpdateFrame));
- while (frame < bottom) {
+ while (frame <= bottom) {
info = get_ret_itbl((StgClosure *)frame);
switch (info->i.type) {
@@ -202,6 +202,11 @@ threadPaused(Capability *cap, StgTSO *tso)
while (1) {
// If we've already marked this frame, then stop here.
if (frame->header.info == (StgInfoTable *)&stg_marked_upd_frame_info) {
+ if (prev_was_update_frame) {
+ words_to_squeeze += sizeofW(StgUpdateFrame);
+ weight += weight_pending;
+ weight_pending = 0;
+ }
goto end;
}
@@ -305,7 +310,7 @@ end:
// the number of words we have to shift down is less than the
// number of stack words we squeeze away by doing so.
if (RtsFlags.GcFlags.squeezeUpdFrames == rtsTrue &&
- weight < words_to_squeeze) {
+ ((weight <= 4 && words_to_squeeze > 0) || weight < words_to_squeeze)) {
stackSqueeze(tso, (StgPtr)frame);
}
}