diff options
author | Reid Barton <rwbarton@gmail.com> | 2015-07-06 19:24:31 +0200 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2015-07-07 10:07:23 +0200 |
commit | aaa0cd20fdaf8e923e3a083befc2612154cba629 (patch) | |
tree | d24962bb4a53f0946eed4e68df27c19c96e36eb6 /compiler/codeGen | |
parent | 9180df19dd938901791b84ef7f260f7e2f1f894f (diff) | |
download | haskell-aaa0cd20fdaf8e923e3a083befc2612154cba629.tar.gz |
Don't eagerly blackhole single-entry thunks (#10414)
In a parallel program they can actually be entered more than once,
leading to deadlock.
Reviewers: austin, simonmar
Subscribers: michaelt, thomie, bgamari
Differential Revision: https://phabricator.haskell.org/D1040
GHC Trac Issues: #10414
Diffstat (limited to 'compiler/codeGen')
-rw-r--r-- | compiler/codeGen/StgCmmClosure.hs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/compiler/codeGen/StgCmmClosure.hs b/compiler/codeGen/StgCmmClosure.hs index b65d56bae2..984e704e3a 100644 --- a/compiler/codeGen/StgCmmClosure.hs +++ b/compiler/codeGen/StgCmmClosure.hs @@ -754,6 +754,16 @@ mkClosureInfo dflags is_static id lf_info tot_wds ptr_wds val_descr -- was on. But it didn't work, and it wasn't strictly necessary -- to bring back minimal ticky-ticky, so now EAGER_BLACKHOLING -- is unconditionally disabled. -- krc 1/2007 +-- +-- +-- A single-entry (non-updatable) thunk can actually be entered +-- more than once in a parallel program, if work is duplicated +-- by two threads both entering the same updatable thunk before +-- the other has blackholed it. So, we must not eagerly +-- blackhole non-updatable thunks, or the second thread to +-- enter one will become blocked indefinitely. (They are not +-- blackholed by lazy blackholing either, since they have no +-- associated update frame.) See Trac #10414. -- Static closures are never themselves black-holed. @@ -766,7 +776,7 @@ blackHoleOnEntry cl_info = case closureLFInfo cl_info of LFReEntrant _ _ _ _ -> False LFLetNoEscape -> False - LFThunk _ _no_fvs _updatable _ _ -> True + LFThunk _ _no_fvs updatable _ _ -> updatable _other -> panic "blackHoleOnEntry" -- Should never happen isStaticClosure :: ClosureInfo -> Bool |