X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=rts%2FHeapStackCheck.cmm;fp=rts%2FHeapStackCheck.cmm;h=10baca23c6789552545ab54fed485ff1c4e2579c;hb=304e7fb703e7afddc1ef9be6aab6505e36b63b06;hp=94cec387cc8c93a4bb84f6c58ad46b3b6c9815f5;hpb=c197fe602ed4aadf09affe0cdc18e7158d262012;p=ghc-hetmet.git diff --git a/rts/HeapStackCheck.cmm b/rts/HeapStackCheck.cmm index 94cec38..10baca2 100644 --- a/rts/HeapStackCheck.cmm +++ b/rts/HeapStackCheck.cmm @@ -23,8 +23,11 @@ import LeaveCriticalSection; * * On discovering that a stack or heap check has failed, we do the following: * - * - If the context_switch flag is set, indicating that there are more - * threads waiting to run, we yield to the scheduler + * - If HpLim==0, indicating that we should context-switch, we yield + * to the scheduler (return ThreadYielding). + * + * - If the context_switch flag is set (the backup plan if setting HpLim + * to 0 didn't trigger a context switch), we yield to the scheduler * (return ThreadYielding). * * - If Hp > HpLim, we've had a heap check failure. This means we've @@ -60,6 +63,10 @@ import LeaveCriticalSection; #define GC_GENERIC \ DEBUG_ONLY(foreign "C" heapCheckFail()); \ if (Hp > HpLim) { \ + if (HpLim == 0) { \ + R1 = ThreadYielding; \ + goto sched; \ + } \ Hp = Hp - HpAlloc/*in bytes*/; \ if (HpAlloc <= BLOCK_SIZE \ && bdescr_link(CurrentNursery) != NULL) { \