[GHC] #8585: Loopification should omit stack check

GHC ghc-devs at haskell.org
Sat Dec 21 18:25:37 UTC 2013


#8585: Loopification should omit stack check
--------------------------------------------+------------------------------
        Reporter:  jstolarek                |            Owner:  jstolarek
            Type:  bug                      |           Status:  new
        Priority:  normal                   |        Milestone:
       Component:  Compiler                 |          Version:  7.7
      Resolution:                           |         Keywords:
Operating System:  Unknown/Multiple         |     Architecture:
 Type of failure:  Runtime performance bug  |  Unknown/Multiple
       Test Case:                           |       Difficulty:  Unknown
        Blocking:                           |       Blocked By:
                                            |  Related Tickets:
--------------------------------------------+------------------------------
Changes (by jstolarek):

 * owner:   => jstolarek


Comment:

 Patrick, your patch validates successfully. I now see that it indeed
 places the loop header in the right place. What I don't fully understand
 in the code that generates the loop header:

 {{{
   self_loop_info <- getSelfLoop
   case self_loop_info of
     Just (_, loop_header_id, _)
         | checkYield && isJust mb_stk_hwm -> emitLabel loop_header_id
     _otherwise -> return ()
 }}}

 is the additional condition `checkYield && isJust mb_stk_hwm`. My
 understanding is that currently heap checks can be placed not only at the
 entry point to a function but also in the case alternatives, thunk entry
 points and few other places (according to Note [Heap checks]). We however
 want to emit loop header only before the heap check made when entering a
 function and I guess that `checkYield && isJust mb_stk_hwm` condition
 accomplishes just that. Is that correct? I wasn't able yet to fully
 convince myself that this always works. I'm not committing the fix until I
 am certain that it will always work the way we intend it to.

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


More information about the ghc-tickets mailing list