[GHC] #9717: More lazy orphan module loading

GHC ghc-devs at haskell.org
Fri Oct 24 01:46:34 UTC 2014


#9717: More lazy orphan module loading
-------------------------------------+-------------------------------------
       Reporter:  ezyang             |                   Owner:  ezyang
           Type:  bug                |                  Status:  new
       Priority:  normal             |               Milestone:  7.10.1
      Component:  Compiler (Type     |                 Version:  7.9
  checker)                           |        Operating System:
       Keywords:  backpack           |  Unknown/Multiple
   Architecture:  Unknown/Multiple   |         Type of failure:
     Difficulty:  Unknown            |  None/Unknown
     Blocked By:                     |               Test Case:
Related Tickets:                     |                Blocking:
                                     |  Differential Revisions:
-------------------------------------+-------------------------------------
 Currently, when we import a module, we eagerly load all of the orphan
 modules transitively reachable from it (TcRnDriver:tcRnImports). This is a
 bit of bummer: as module import hierarchies get deeper and deeper, we'll
 collect more and more orphan instances and load more and more modules
 eagerly.

 The idea is to try to arrange for an orphan module not to be loaded,
 unless we think that it might have a relevant instance. Instead of just
 recording a list of orphan modules transitively reachable from a module,
 we will also record a digest of what type classes and types the orphan
 provides instances for. (This will be similar to the data we record for
 `ifInstTys` in `IfaceClsInst`.)

 Now, when we do any operation involving instances, we check and see if
 there are also orphans which could provide relevant instances (based on
 the digest) and load those. If an instance could never have been used, we
 avoid loading its interface file entirely.

 This doesn't appear to help too much for type families, where we have to
 load all of the instances anyway in order to check for consistency.

 A choice to make: Should we record just the class, or also the types
 involved? It would be best if we could quickly conclude that there are no
 more instances to load, but this may be difficult if matching against
 types as well.

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


More information about the ghc-tickets mailing list