X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=rts%2FSchedule.c;h=a9ea81bbe44f75aad7d945d03c7d81d1a707d463;hb=27de38efce6d73d2a0209f803cfa98c82773e773;hp=c07b21aac15c3571f5b44df92a87cc4033aef20e;hpb=e7987f16175f88daa11f06f25d10161a95f84bc4;p=ghc-hetmet.git diff --git a/rts/Schedule.c b/rts/Schedule.c index c07b21a..a9ea81b 100644 --- a/rts/Schedule.c +++ b/rts/Schedule.c @@ -550,8 +550,6 @@ schedule (Capability *initialCapability, Task *task) } #endif - cap->r.rCurrentTSO = t; - /* context switches are initiated by the timer signal, unless * the user specified "context switch as often as possible", with * +RTS -C0 @@ -563,6 +561,11 @@ schedule (Capability *initialCapability, Task *task) run_thread: + // CurrentTSO is the thread to run. t might be different if we + // loop back to run_thread, so make sure to set CurrentTSO after + // that. + cap->r.rCurrentTSO = t; + debugTrace(DEBUG_sched, "-->> running thread %ld %s ...", (long)t->id, whatNext_strs[t->what_next]); @@ -1002,6 +1005,8 @@ scheduleDetectDeadlock (Capability *cap, Task *task) // either we have threads to run, or we were interrupted: ASSERT(!emptyRunQueue(cap) || sched_state >= SCHED_INTERRUPTING); + + return; } #endif @@ -1016,7 +1021,7 @@ scheduleDetectDeadlock (Capability *cap, Task *task) case BlockedOnException: case BlockedOnMVar: throwToSingleThreaded(cap, task->tso, - (StgClosure *)NonTermination_closure); + (StgClosure *)nonTermination_closure); return; default: barf("deadlock: main thread blocked in a strange way"); @@ -1474,9 +1479,7 @@ schedulePostRunThread (StgTSO *t) throwToSingleThreaded_(&capabilities[0], t, NULL, rtsTrue, NULL); -#ifdef REG_R1 ASSERT(get_itbl((StgClosure *)t->sp)->type == ATOMICALLY_FRAME); -#endif } } @@ -1640,7 +1643,7 @@ scheduleHandleHeapOverflow( Capability *cap, StgTSO *t ) } debugTrace(DEBUG_sched, - "--<< thread %ld (%s) stopped: HeapOverflow\n", + "--<< thread %ld (%s) stopped: HeapOverflow", (long)t->id, whatNext_strs[t->what_next]); #if defined(GRAN) @@ -2819,6 +2822,8 @@ threadStackUnderflow (Task *task STG_UNUSED, StgTSO *tso) bd = Bdescr((StgPtr)tso); new_bd = splitLargeBlock(bd, new_tso_size_w / BLOCK_SIZE_W); + new_bd->free = bd->free; + bd->free = bd->start + TSO_STRUCT_SIZEW; new_tso = (StgTSO *)new_bd->start; memcpy(new_tso,tso,TSO_STRUCT_SIZE); @@ -3151,7 +3156,7 @@ resurrectThreads (StgTSO *threads) break; case BlockedOnBlackHole: throwToSingleThreaded(cap, tso, - (StgClosure *)NonTermination_closure); + (StgClosure *)nonTermination_closure); break; case BlockedOnSTM: throwToSingleThreaded(cap, tso,