rts: Clarify whitehole logic in threadPaused
authorBen Gamari <bgamari.foss@gmail.com>
Tue, 27 Jun 2017 14:30:00 +0000 (10:30 -0400)
committerBen Gamari <ben@smart-cactus.org>
Tue, 27 Jun 2017 16:55:06 +0000 (12:55 -0400)
Previously we would look at the indirectee field of a WHITEHOLE object.
However, WHITEHOLE isn't a sort of indirection and therefore has no
indirectee field.

I encountered this while investigating #13615, although it doesn't fix
that bug.

Test Plan: Validate

Reviewers: simonmar, austin, erikd

Subscribers: rwbarton, thomie

GHC Trac Issues: #13615

Differential Revision: https://phabricator.haskell.org/D3674

rts/ThreadPaused.c

index 4ebc632..2483466 100644 (file)
@@ -275,10 +275,9 @@ threadPaused(Capability *cap, StgTSO *tso)
             // deadlocked on itself.  See #5226 for an instance of
             // this bug.
             //
-            if ((bh_info == &stg_WHITEHOLE_info ||
-                 bh_info == &stg_BLACKHOLE_info)
-                &&
-                ((StgInd*)bh)->indirectee != (StgClosure*)tso)
+            if (((bh_info == &stg_BLACKHOLE_info)
+                 && ((StgInd*)bh)->indirectee != (StgClosure*)tso)
+                || (bh_info == &stg_WHITEHOLE_info))
             {
                 debugTrace(DEBUG_squeeze,
                            "suspending duplicate work: %ld words of stack",