[GHC] #8275: Loopification breaks profiling
GHC
ghc-devs at haskell.org
Fri Nov 29 18:56:54 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:
----------------------------------------+----------------------------------
Changes (by parcs):
* status: new => patch
Comment:
I have attached a patch that fixes loopification with profiling. The
problem is that `nodeReg` aka R1 may get clobbered inside the body of a
closure. With profiling, upon entering a closure, `enterFunCCS` is called
with R1 passed to it. But since R1 may get clobbered inside the body of a
closure, and since a self-recursive tail call does not restore R1, a
subsequent call to `enterFunCCS` may be passed a bogus value from R1.
The solution is to not pass `nodeReg` aka R1 to `enterFunCCS`. Instead, we
pass `node`, the callee-saved temporary that stores the original value of
R1. This way R1 may get clobbered and loopification will not care.
I don't know whether it's necessary to re-run the LDV code after looping.
Not doing so certainly does not cause a segfault, anyway.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8275#comment:32>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list