[GHC] #3437: Optimizer creates space leak on simple code

GHC trac at galois.com
Fri Aug 21 05:59:49 EDT 2009


#3437: Optimizer creates space leak on simple code
-------------------------------------------+--------------------------------
    Reporter:  lilac                       |        Owner:         
        Type:  run-time performance bug    |       Status:  closed 
    Priority:  normal                      |    Milestone:         
   Component:  Compiler                    |      Version:  6.10.3 
    Severity:  normal                      |   Resolution:  fixed  
    Keywords:                              |   Difficulty:  Unknown
    Testcase:  simplCore/should_run/T3437  |           Os:  Linux  
Architecture:  x86_64 (amd64)              |  
-------------------------------------------+--------------------------------
Changes (by simonpj):

  * testcase:  => simplCore/should_run/T3437
  * status:  new => closed
  * resolution:  => fixed
  * type:  bug => run-time performance bug

Comment:

 Done! Fixed by
 {{{
 Fri Aug 21 10:52:51 BST 2009  simonpj at microsoft.com
   * Fix Trac #3437: strictness of specialised functions

   'lilac' helpful pin-pointed a space leak that was due to a specialised
   function being insufficiently strict.  Here's the new comment in
 SpecConstr:

   Note [Transfer strictness]
   ~~~~~~~~~~~~~~~~~~~~~~~~~~
   We must transfer strictness information from the original function to
   the specialised one.  Suppose, for example

     f has strictness     SS
           and a RULE     f (a:as) b = f_spec a as b

   Now we want f_spec to have strictess  LLS, otherwise we'll use call-by-
 need
   when calling f_spec instead of call-by-value.  And that can result in
   unbounded worsening in space (cf the classic foldl vs foldl')

   See Trac #3437 for a good example.

   The function calcSpecStrictness performs the calculation.



     M ./compiler/specialise/SpecConstr.lhs +44
 }}}
 Thank you for identifying the problem so precisely.

 Simon

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


More information about the Glasgow-haskell-bugs mailing list