X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=rts%2FThreadPaused.c;h=96a23673a7348da0011a6bf2a24a4e65353c3c6d;hb=f4b727487a65e6b611bbaafbd2207bd63a8df706;hp=4882ab2374b148c603661378a8c58c9b2c989816;hpb=b55e7b53eb4af373764969ab9cfd5a4ef4bc9b8d;p=ghc-hetmet.git diff --git a/rts/ThreadPaused.c b/rts/ThreadPaused.c index 4882ab2..96a2367 100644 --- a/rts/ThreadPaused.c +++ b/rts/ThreadPaused.c @@ -6,13 +6,14 @@ * * ---------------------------------------------------------------------------*/ +// #include "PosixSource.h" #include "Rts.h" -#include "Storage.h" -#include "LdvProfile.h" + +#include "ThreadPaused.h" +#include "sm/Storage.h" #include "Updates.h" #include "RaiseAsync.h" #include "Trace.h" -#include "RtsFlags.h" #include // for memmove() @@ -141,23 +142,23 @@ stackSqueeze(StgTSO *tso, StgPtr bottom) // indicates unused // { - void *sp; - void *gap_start, *next_gap_start, *gap_end; + StgWord8 *sp; + StgWord8 *gap_start, *next_gap_start, *gap_end; nat chunk_size; - next_gap_start = (void *)((unsigned char*)gap + sizeof(StgUpdateFrame)); + next_gap_start = (StgWord8*)gap + sizeof(StgUpdateFrame); sp = next_gap_start; while ((StgPtr)gap > tso->sp) { // we're working in *bytes* now... gap_start = next_gap_start; - gap_end = (void*) ((unsigned char*)gap_start - gap->gap_size * sizeof(W_)); + gap_end = gap_start - gap->gap_size * sizeof(W_); gap = gap->next_gap; - next_gap_start = (void *)((unsigned char*)gap + sizeof(StgUpdateFrame)); + next_gap_start = (StgWord8*)gap + sizeof(StgUpdateFrame); - chunk_size = (unsigned char*)gap_end - (unsigned char*)next_gap_start; + chunk_size = gap_end - next_gap_start; sp -= chunk_size; memmove(sp, next_gap_start, chunk_size); } @@ -316,5 +317,10 @@ end: if (RtsFlags.GcFlags.squeezeUpdFrames == rtsTrue && ((weight <= 5 && words_to_squeeze > 0) || weight < words_to_squeeze)) { stackSqueeze(tso, (StgPtr)frame); + tso->flags |= TSO_SQUEEZED; + // This flag tells threadStackOverflow() that the stack was + // squeezed, because it may not need to be expanded. + } else { + tso->flags &= ~TSO_SQUEEZED; } }