summaryrefslogtreecommitdiff
path: root/rts/ThreadPaused.c
diff options
context:
space:
mode:
authorBen Gamari <bgamari.foss@gmail.com>2017-07-03 19:10:07 -0400
committerBen Gamari <ben@smart-cactus.org>2017-07-03 19:42:22 -0400
commitfd7a7a6363d8dde1813bc23cb4ef00ebb70a49c0 (patch)
treeeab8f5e155dbe389bfc43d577dee38970474dded /rts/ThreadPaused.c
parent0836bfbd480b00a690937060fc98df5e26453078 (diff)
downloadhaskell-fd7a7a6363d8dde1813bc23cb4ef00ebb70a49c0.tar.gz
Eagerly blackhole AP_STACKs
This fixes #13615. See the rather lengthy Note [AP_STACKs must be eagerly blackholed] for details. Reviewers: simonmar, austin, erikd, dfeuer Subscribers: duog, dfeuer, hsyl20, rwbarton, thomie GHC Trac Issues: #13615 Differential Revision: https://phabricator.haskell.org/D3695
Diffstat (limited to 'rts/ThreadPaused.c')
-rw-r--r--rts/ThreadPaused.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/rts/ThreadPaused.c b/rts/ThreadPaused.c
index 2483466255..d01be291d3 100644
--- a/rts/ThreadPaused.c
+++ b/rts/ThreadPaused.c
@@ -275,6 +275,9 @@ threadPaused(Capability *cap, StgTSO *tso)
// deadlocked on itself. See #5226 for an instance of
// this bug.
//
+ // Note that great care is required when entering computations
+ // suspended by this mechanism. See Note [AP_STACKs must be eagerly
+ // blackholed] for details.
if (((bh_info == &stg_BLACKHOLE_info)
&& ((StgInd*)bh)->indirectee != (StgClosure*)tso)
|| (bh_info == &stg_WHITEHOLE_info))
@@ -303,6 +306,12 @@ threadPaused(Capability *cap, StgTSO *tso)
continue;
}
+ // We should never have made it here in the event of blackholes that
+ // we already own; they should have been marked when we blackholed
+ // them and consequently we should have stopped our stack walk
+ // above.
+ ASSERT(!((bh_info == &stg_BLACKHOLE_info)
+ && (((StgInd*)bh)->indirectee == (StgClosure*)tso)));
// zero out the slop so that the sanity checker can tell
// where the next closure is.