[GHC] #14391: Make the simplifier independent of the typechecker

GHC ghc-devs at haskell.org
Thu Sep 6 12:59:12 UTC 2018


#14391: Make the simplifier independent of the typechecker
-------------------------------------+-------------------------------------
        Reporter:  nomeata           |                Owner:  (none)
            Type:  task              |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.3
      Resolution:                    |             Keywords:  newcomer
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):  Phab:D4503
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by monoidal):

 I created a graph with all module dependencies in `compiler/`.

 If we don't count SOURCE imports, this graph is acyclic.

 If we do, there are cyclic dependencies, and we can analyze strongly
 connected components. Currently, there are 440 modules, but 357 of them
 are in the same component. In other words, we have 357 modules that import
 directly or indirectly each other. The full structure is 1*76 + 7 + 357.
 This means there's a bunch of one-element components, one 7-element
 component (FastString, Pretty, Panic, Outputable etc.) and everything else
 is in a big chunk.

 In total, there are 78 components. What if we could magically remove only
 one edge from this graph and try to obtain the largest amount of
 components? Here are the winners, the larger the better:

 {{{
 # of components / import from / import to / new structure
 282 typecheck/TcRnMonad.hs -> typecheck/TcSplice.hs 1*273 + 2*2 + 4 + 6 +
 7*2 + 11 + 15 + 113
 259 typecheck/TcSplice.hs -> main/HscMain.hs        1*252 + 2*4 + 4 + 7 +
 169
 242 simplCore/CoreMonad.hs -> typecheck/TcEnv.hs    1*236 + 2*2 + 4 + 7 +
 88 + 101
 235 main/DynFlags.hs -> main/Plugins.hs             1*229 + 2*2 + 4 + 7 +
 96 + 100
 234 main/Plugins.hs -> simplCore/CoreMonad.hs       1*228 + 2*2 + 4 + 7 +
 98 + 99
 137 main/HscMain.hs -> main/CodeOutput.hs           1*134 + 4 + 7 + 295
 128 main/CodeOutput.hs -> nativeGen/AsmCodeGen.hs   1*125 + 4 + 7 + 304
 97  main/HscMain.hs -> simplCore/SimplCore.hs       1*95 + 7 + 338
 78  [current situation]                             1*76 + 7 + 357
 }}}

 This ticket shows up at the third place (CoreMonad -> TcEnv). If we could
 remove CoreMonad -> TcEnv import, the structure would improve to 1*236 +
 2*2 + 4 + 7 + 88 + 101. Instead of a 357-sized cyclic chunk, we would have
 half of the modules not participating in any cycle, and the big chunk
 reduced to two smaller ones.

 Of course, my script didn't consider whether any item on this list is
 realistic.

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


More information about the ghc-tickets mailing list