From: Simon Marlow Date: Wed, 8 Oct 2008 11:26:09 +0000 (+0000) Subject: Fix #2663: we had a hard-wired capabilities[0] X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=commitdiff_plain;h=8ec22a59d5dca42053a7b4fdc7897925b9cb2eec Fix #2663: we had a hard-wired capabilities[0] For some unknown reason in schedulePostRunThread() we were always passing capabilities[0] rather than the current Capability to throwToSingleThreaded(). This caused all kinds of weird failures and crashes in STM code when running on multiple processors. --- diff --git a/rts/Schedule.c b/rts/Schedule.c index 8c254cc..f53687a 100644 --- a/rts/Schedule.c +++ b/rts/Schedule.c @@ -150,7 +150,7 @@ static rtsBool scheduleGetRemoteWork(Capability *cap); static void scheduleSendPendingMessages(void); static void scheduleActivateSpark(Capability *cap); #endif -static void schedulePostRunThread(StgTSO *t); +static void schedulePostRunThread(Capability *cap, StgTSO *t); static rtsBool scheduleHandleHeapOverflow( Capability *cap, StgTSO *t ); static void scheduleHandleStackOverflow( Capability *cap, Task *task, StgTSO *t); @@ -622,7 +622,7 @@ run_thread: CCCS = CCS_SYSTEM; #endif - schedulePostRunThread(t); + schedulePostRunThread(cap,t); t = threadStackUnderflow(task,t); @@ -1064,7 +1064,7 @@ scheduleGetRemoteWork(Capability *cap) * ------------------------------------------------------------------------- */ static void -schedulePostRunThread (StgTSO *t) +schedulePostRunThread (Capability *cap, StgTSO *t) { // We have to be able to catch transactions that are in an // infinite loop as a result of seeing an inconsistent view of @@ -1085,8 +1085,7 @@ schedulePostRunThread (StgTSO *t) // ATOMICALLY_FRAME, aborting the (nested) // transaction, and saving the stack of any // partially-evaluated thunks on the heap. - throwToSingleThreaded_(&capabilities[0], t, - NULL, rtsTrue, NULL); + throwToSingleThreaded_(cap, t, NULL, rtsTrue, NULL); ASSERT(get_itbl((StgClosure *)t->sp)->type == ATOMICALLY_FRAME); }