diff options
Diffstat (limited to 'compiler/codeGen/CgClosure.lhs')
-rw-r--r-- | compiler/codeGen/CgClosure.lhs | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/compiler/codeGen/CgClosure.lhs b/compiler/codeGen/CgClosure.lhs index ffaa5eec8b..2f312016c7 100644 --- a/compiler/codeGen/CgClosure.lhs +++ b/compiler/codeGen/CgClosure.lhs @@ -394,9 +394,8 @@ thunkWrapper closure_info thunk_code = do -- Stack and/or heap checks ; thunkEntryChecks closure_info $ do { - dflags <- getDynFlags -- Overwrite with black hole if necessary - ; whenC (blackHoleOnEntry dflags closure_info && node_points) + ; whenC (blackHoleOnEntry closure_info && node_points) (blackHoleIt closure_info) ; setupUpdate closure_info thunk_code } -- setupUpdate *encloses* the thunk_code @@ -449,13 +448,39 @@ blackHoleIt closure_info = emitBlackHoleCode (closureSingleEntry closure_info) emitBlackHoleCode :: Bool -> Code emitBlackHoleCode is_single_entry = do + dflags <- getDynFlags + + -- Eager blackholing is normally disabled, but can be turned on with + -- -feager-blackholing. When it is on, we replace the info pointer + -- of the thunk with stg_EAGER_BLACKHOLE_info on entry. + + -- If we wanted to do eager blackholing with slop filling, we'd need + -- to do it at the *end* of a basic block, otherwise we overwrite + -- the free variables in the thunk that we still need. We have a + -- patch for this from Andy Cheadle, but not incorporated yet. --SDM + -- [6/2004] + -- + -- Previously, eager blackholing was enabled when ticky-ticky 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 + + -- Note the eager-blackholing check is here rather than in blackHoleOnEntry, + -- because emitBlackHoleCode is called from CmmParse. + + let eager_blackholing = not opt_SccProfilingOn + && dopt Opt_EagerBlackHoling dflags + -- Profiling needs slop filling (to support LDV + -- profiling), so currently eager blackholing doesn't + -- work with profiling. + + whenC eager_blackholing $ do tickyBlackHole (not is_single_entry) - let bh_info = CmmReg (CmmGlobal EagerBlackholeInfo) stmtsC [ CmmStore (cmmOffsetW (CmmReg nodeReg) fixedHdrSize) (CmmReg (CmmGlobal CurrentTSO)), CmmCall (CmmPrim MO_WriteBarrier) [] [] CmmUnsafe CmmMayReturn, - CmmStore (CmmReg nodeReg) bh_info + CmmStore (CmmReg nodeReg) (CmmReg (CmmGlobal EagerBlackholeInfo)) ] \end{code} |