[GHC] #14461: Reuse free variable lists through nested closures

GHC ghc-devs at haskell.org
Wed Nov 15 11:03:46 UTC 2017


#14461: Reuse free variable lists through nested closures
-------------------------------------+-------------------------------------
        Reporter:  tdammers          |                Owner:  alexbiehl
            Type:  task              |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.2.1
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  7258              |  Differential Rev(s):
       Wiki Page:  NestedClosures    |
-------------------------------------+-------------------------------------

Comment (by simonpj):

 Yes you could do that in Core, but the simplifier would immediately undo
 it by eliminating the inner case.

 However, in our proposed STG-level transformation, I think we could indeed
 transform
 {{{
   case e of x {
     T a b c ->
       let [a b c] f = \[] -> ...
   }
 }}}
 to
 {{{
   case e of x {
     T _ _ _ ->
       let [x{a,b,c}] f = \[] -> ...
   }
 }}}
 using the notation on the wiki page.

 I'm beginning to think that it might be easier to do this free-var-finding
 stuff as a STG-to-STG pass with a single purpose, rather than as part of
 Core-to-STG.

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


More information about the ghc-tickets mailing list