#7231: GHCi erroneously unloads modules after a failed :reload
------------------------------------------+---------------------------------
 Reporter:  parcs                         |          Owner:                  
     Type:  bug                           |         Status:  new             
 Priority:  normal                        |      Component:  GHCi            
  Version:  7.6.1                         |       Keywords:                  
       Os:  Unknown/Multiple              |   Architecture:  Unknown/Multiple
  Failure:  Compile-time performance bug  |       Testcase:                  
Blockedby:                                |       Blocking:                  
  Related:                                |  
------------------------------------------+---------------------------------

Comment(by parcs):

 I have appended a potential fix for this issue. Instead of loading modules
 in a topological order, modules are sorted according to their stability
 (stable modules are loaded before unstable ones) followed by their
 topological order. It should be safe to load all stable modules before all
 unstable modules because stable modules can only depend on other stable
 modules.

 {{{
 diff --git a/compiler/main/GhcMake.hs b/compiler/main/GhcMake.hs
 index 322c631..dd3633c 100644
 --- a/compiler/main/GhcMake.hs
 +++ b/compiler/main/GhcMake.hs
 @@ -238,11 +238,16 @@ load how_much = do
          stable_mg =
              [ AcyclicSCC ms
              | AcyclicSCC ms <- full_mg,
 -              ms_mod_name ms `elem` stable_obj++stable_bco,
 -              ms_mod_name ms `notElem` [ ms_mod_name ms' |
 -                                            AcyclicSCC ms' <- partial_mg
 ] ]
 +              ms_mod_name ms `elem` stable_obj++stable_bco ]

 -        mg = stable_mg ++ partial_mg
 +        unstable_mg =
 +            [ AcyclicSCC ms
 +            | AcyclicSCC ms <- partial_mg,
 +              ms_mod_name ms `notElem` stable_obj++stable_bco ]
 +
 +        -- Load all the stable modules first, before attempting to load
 +        -- an unstable module (#7231).
 +        mg = stable_mg ++ unstable_mg

      -- clean up between compilations
      let cleanup hsc_env = intermediateCleanTempFiles dflags
 }}}

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

_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to