[GHC] #8275: Loopification breaks profiling
GHC
ghc-devs at haskell.org
Fri Nov 29 21:06:50 UTC 2013
#8275: Loopification breaks profiling
----------------------------------------+----------------------------------
Reporter: jstolarek | Owner:
Type: bug | Status: patch
Priority: high | Milestone: 7.8.1
Component: Profiling | Version: 7.7
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: Building GHC failed | Unknown/Multiple
Test Case: | Difficulty: Unknown
Blocking: | Blocked By: 8456
| Related Tickets:
----------------------------------------+----------------------------------
Comment (by parcs):
Replying to [comment:33 jstolarek]:
> Thanks Patrick! Currently I'm without my main laptop so I can't verify
your patch - I will do it in Wednesday, unless someone else can do it
before.
Okay, great.
And here's an ugly PoC patch that moves the self-loop label below the
stack check:
{{{
#!diff
diff --git a/compiler/codeGen/StgCmmBind.hs
b/compiler/codeGen/StgCmmBind.hs
index 16477c8..029b8af 100644
--- a/compiler/codeGen/StgCmmBind.hs
+++ b/compiler/codeGen/StgCmmBind.hs
@@ -481,7 +481,6 @@ closureCodeBody top_lvl bndr cl_info cc args arity
body fv_details
-- of a self-recursive tail call. See Note
-- [Self-recursive tail calls] in StgCmmExpr
; loop_header_id <- newLabelC
- ; emitLabel loop_header_id
-- Extend reader monad with information that
-- self-recursive tail calls can be optimized into local
-- jumps
diff --git a/compiler/codeGen/StgCmmHeap.hs
b/compiler/codeGen/StgCmmHeap.hs
index 55ddfd4..f01d042 100644
--- a/compiler/codeGen/StgCmmHeap.hs
+++ b/compiler/codeGen/StgCmmHeap.hs
@@ -615,6 +615,12 @@ do_checks mb_stk_hwm checkYield mb_alloc_lit do_gc =
do
Nothing -> return ()
Just stk_hwm -> tickyStackCheck >> (emit =<< mkCmmIfGoto (sp_oflo
stk_hwm) gc_id)
+ self_loop_info <- getSelfLoop
+ case self_loop_info of
+ Just (_,loop_header_id,_)
+ | checkYield && isJust mb_stk_hwm -> emitLabel loop_header_id
+ _otherwise -> return ()
+
if (isJust mb_alloc_lit)
then do
tickyHeapCheck
}}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8275#comment:34>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list