X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=rts%2FMessages.c;h=173027893061556df73d930c73c1c701cbd3adc7;hb=8625c675de45bdb8bcfa795572ce7c47687c147c;hp=91ee9a6574efe195bb63077a274e485db9104bfc;hpb=b2e840ee0c95fb549d40950f43cc6e4afc177a46;p=ghc-hetmet.git diff --git a/rts/Messages.c b/rts/Messages.c index 91ee9a6..1730278 100644 --- a/rts/Messages.c +++ b/rts/Messages.c @@ -98,11 +98,13 @@ loop: r = throwToMsg(cap, t); switch (r) { - case THROWTO_SUCCESS: + case THROWTO_SUCCESS: { // this message is done - unlockClosure((StgClosure*)m, &stg_MSG_NULL_info); - tryWakeupThread(cap, t->source); + StgTSO *source = t->source; + doneWithMsgThrowTo(t); + tryWakeupThread(cap, source); break; + } case THROWTO_BLOCKED: // unlock the message unlockClosure((StgClosure*)m, &stg_MSG_THROWTO_info); @@ -161,7 +163,7 @@ nat messageBlackHole(Capability *cap, MessageBlackHole *msg) const StgInfoTable *info; StgClosure *p; StgBlockingQueue *bq; - StgClosure *bh = msg->bh; + StgClosure *bh = UNTAG_CLOSURE(msg->bh); StgTSO *owner; debugTraceCap(DEBUG_sched, cap, "message: thread %d blocking on blackhole %p", @@ -175,6 +177,7 @@ nat messageBlackHole(Capability *cap, MessageBlackHole *msg) // all. if (info != &stg_BLACKHOLE_info && info != &stg_CAF_BLACKHOLE_info && + info != &__stg_EAGER_BLACKHOLE_info && info != &stg_WHITEHOLE_info) { // if it is a WHITEHOLE, then a thread is in the process of // trying to BLACKHOLE it. But we know that it was once a @@ -186,7 +189,9 @@ nat messageBlackHole(Capability *cap, MessageBlackHole *msg) // The blackhole must indirect to a TSO, a BLOCKING_QUEUE, an IND, // or a value. loop: - p = UNTAG_CLOSURE(((StgInd*)bh)->indirectee); + // NB. VOLATILE_LOAD(), because otherwise gcc hoists the load + // and turns this into an infinite loop. + p = UNTAG_CLOSURE((StgClosure*)VOLATILE_LOAD(&((StgInd*)bh)->indirectee)); info = p->header.info; if (info == &stg_IND_info) @@ -200,7 +205,7 @@ loop: else if (info == &stg_TSO_info) { - owner = deRefTSO((StgTSO *)p); + owner = (StgTSO*)p; #ifdef THREADED_RTS if (owner->cap != cap) { @@ -262,7 +267,7 @@ loop: ASSERT(bq->bh == bh); - owner = deRefTSO(bq->owner); + owner = bq->owner; ASSERT(owner != END_TSO_QUEUE);