[GHC] #8275: Loopification breaks profiling

GHC ghc-devs at haskell.org
Wed Oct 16 11:05:25 UTC 2013


#8275: Loopification breaks profiling
----------------------------------------+----------------------------------
        Reporter:  jstolarek            |            Owner:
            Type:  bug                  |           Status:  new
        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:  8298                 |       Blocked By:
                                        |  Related Tickets:
----------------------------------------+----------------------------------

Comment (by Jan Stolarek <jan.stolarek@…>):

 In [changeset:"94125c97e49987e91fa54da6c86bc6d17417f5cf/ghc"]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="94125c97e49987e91fa54da6c86bc6d17417f5cf"
 Generate (old + 0) instead of Sp in stack checks

 When compiling a function we can determine how much stack space it will
 use. We therefore need to perform only a single stack check at the
 beginning
 of a function to see if we have enough stack space. Instead of referring
 directly to Sp - as we used to do in the past - the code generator uses
 (old + 0) in the stack check. Stack layout phase turns (old + 0) into Sp.

 The idea here is that, while we need to perform only one stack check for
 each function, we could in theory place more stack checks later in the
 function. They would be redundant, but not incorrect (in a sense that they
 should not change program behaviour). We need to make sure however that a
 stack check inserted after incrementing the stack pointer checks for a
 respectively smaller stack space. This would not be the case if the code
 generator produced direct references to Sp. By referencing (old + 0) we
 make
 sure that we always check for a correct amount of stack: when converting
 (old + 0) to Sp the stack layout phase takes into account changes already
 made to stack pointer. The idea for this change came from observations
 made
 while debugging #8275.
 }}}

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8275#comment:19>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list