summaryrefslogtreecommitdiff
path: root/rts/Threads.c
diff options
context:
space:
mode:
authorKavon Farvardin <kavon@farvard.in>2018-09-23 15:29:37 -0500
committerKavon Farvardin <kavon@farvard.in>2018-09-23 15:29:37 -0500
commit84c2ad99582391005b5e873198b15e9e9eb4f78d (patch)
treecaa8c2f2ec7e97fbb4977263c6817c9af5025cf4 /rts/Threads.c
parent8ddb47cfcf5776e9a3c55fd37947c8a95e00fa12 (diff)
parente68b439fe5de61b9a2ca51af472185c62ccb8b46 (diff)
downloadhaskell-wip/T13904.tar.gz
update to current master againwip/T13904
Diffstat (limited to 'rts/Threads.c')
-rw-r--r--rts/Threads.c34
1 files changed, 10 insertions, 24 deletions
diff --git a/rts/Threads.c b/rts/Threads.c
index c87551180b..977635322d 100644
--- a/rts/Threads.c
+++ b/rts/Threads.c
@@ -165,19 +165,8 @@ rts_getThreadId(StgPtr tso)
}
/* ---------------------------------------------------------------------------
- * Getting & setting the thread allocation limit
+ * Enabling and disabling the thread allocation limit
* ------------------------------------------------------------------------ */
-HsInt64 rts_getThreadAllocationCounter(StgPtr tso)
-{
- // NB. doesn't take into account allocation in the current nursery
- // block, so it might be off by up to 4k.
- return PK_Int64((W_*)&(((StgTSO *)tso)->alloc_limit));
-}
-
-void rts_setThreadAllocationCounter(StgPtr tso, HsInt64 i)
-{
- ASSIGN_Int64((W_*)&(((StgTSO *)tso)->alloc_limit), i);
-}
void rts_enableThreadAllocationLimit(StgPtr tso)
{
@@ -308,8 +297,11 @@ tryWakeupThread (Capability *cap, StgTSO *tso)
goto unblock;
}
- case BlockedOnBlackHole:
case BlockedOnSTM:
+ tso->block_info.closure = &stg_STM_AWOKEN_closure;
+ goto unblock;
+
+ case BlockedOnBlackHole:
case ThreadMigrating:
goto unblock;
@@ -379,12 +371,6 @@ wakeBlockingQueue(Capability *cap, StgBlockingQueue *bq)
// overwrite the BQ with an indirection so it will be
// collected at the next GC.
-#if defined(DEBUG) && !defined(THREADED_RTS)
- // XXX FILL_SLOP, but not if THREADED_RTS because in that case
- // another thread might be looking at this BLOCKING_QUEUE and
- // checking the owner field at the same time.
- bq->bh = 0; bq->queue = 0; bq->owner = 0;
-#endif
OVERWRITE_INFO(bq, &stg_IND_info);
}
@@ -446,7 +432,7 @@ updateThunk (Capability *cap, StgTSO *tso, StgClosure *thunk, StgClosure *val)
return;
}
- v = ((StgInd*)thunk)->indirectee;
+ v = UNTAG_CLOSURE(((StgInd*)thunk)->indirectee);
updateWithIndirection(cap, thunk, val);
@@ -640,8 +626,8 @@ threadStackOverflow (Capability *cap, StgTSO *tso)
// if including this frame would exceed the size of the
// new stack (taking into account the underflow frame),
// then stop at the previous frame.
- if (sp + size > old_stack->stack + (new_stack->stack_size -
- sizeofW(StgUnderflowFrame))) {
+ if (sp + size > old_stack->sp + (new_stack->stack_size -
+ sizeofW(StgUnderflowFrame))) {
break;
}
sp += size;
@@ -808,7 +794,7 @@ loop:
tryWakeupThread(cap, tso);
- // If it was an readMVar, then we can still do work,
+ // If it was a readMVar, then we can still do work,
// so loop back. (XXX: This could take a while)
if (why_blocked == BlockedOnMVarRead) {
q = ((StgMVarTSOQueue*)q)->link;
@@ -876,7 +862,7 @@ printThreadBlockage(StgTSO *tso)
debugBelch("is blocked on an STM operation");
break;
default:
- barf("printThreadBlockage: strange tso->why_blocked: %d for TSO %d (%d)",
+ barf("printThreadBlockage: strange tso->why_blocked: %d for TSO %d (%p)",
tso->why_blocked, tso->id, tso);
}
}