Wolfgang Jeltsch pushed to branch wip/jeltsch/module-graph-reuse-in-downsweep at Glasgow Haskell Compiler / GHC
Commits:
-
50cb937a
by Wolfgang Jeltsch at 2026-05-27T17:58:06+03:00
2 changed files:
- testsuite/tests/ghc-api/downsweep/IncrementalDownsweep.hs
- testsuite/tests/ghc-api/downsweep/IncrementalDownsweep.stdout
Changes:
| ... | ... | @@ -76,18 +76,28 @@ main :: IO () |
| 76 | 76 | main = do
|
| 77 | 77 | libDir : otherArgs <- getArgs
|
| 78 | 78 | runGhc (Just libDir) $ withSimpleErrorHandler $ do
|
| 79 | + |
|
| 80 | + -- Setup
|
|
| 79 | 81 | logger <- getLogger
|
| 80 | 82 | originalDynFlags <- getSessionDynFlags
|
| 81 | 83 | (finalDynFlags, _, _)
|
| 82 | 84 | <- parseDynamicFlags logger originalDynFlags $
|
| 83 | 85 | map noLoc (["-i", "-i" ++ sourceDirectory] ++ otherArgs)
|
| 84 | 86 | _ <- setSessionDynFlags finalDynFlags
|
| 85 | - intermediateModuleGraph
|
|
| 86 | - <- performDownsweepTurn Nothing "A"
|
|
| 87 | - liftIO $ outputModuleNamesInGraph intermediateModuleGraph
|
|
| 87 | + |
|
| 88 | + -- Turn 1: From scratch, using 'A' as root
|
|
| 89 | + moduleGraph1 <- performDownsweepTurn Nothing "A"
|
|
| 90 | + liftIO $ outputModuleNamesInGraph moduleGraph1
|
|
| 91 | + |
|
| 92 | + -- Turn 2: From scratch, using 'X' as root
|
|
| 93 | + moduleGraph2 <- performDownsweepTurn Nothing "X"
|
|
| 94 | + liftIO $ outputModuleNamesInGraph moduleGraph2
|
|
| 95 | + |
|
| 96 | + -- Deletion of the source files used in turn 1
|
|
| 88 | 97 | _ <- liftIO $
|
| 89 | 98 | mapM_ (((sourceDirectory ++ "/") ++) >>> (++ ".hs") >>> removeFile)
|
| 90 | 99 | ["A", "B", "C", "D"]
|
| 91 | - finalModuleGraph
|
|
| 92 | - <- performDownsweepTurn (Just intermediateModuleGraph) "X"
|
|
| 93 | - liftIO $ outputModuleNamesInGraph finalModuleGraph |
|
| 100 | + |
|
| 101 | + -- Turn 3: Based on the result of turn 1, using 'X' as root
|
|
| 102 | + moduleGraph3 <- performDownsweepTurn (Just moduleGraph1) "X"
|
|
| 103 | + liftIO $ outputModuleNamesInGraph moduleGraph3 |
| 1 | 1 | ["A","B","C","D"]
|
| 2 | +["B","C","D","X","Y","Z"]
|
|
| 2 | 3 | ["A","B","C","D","X","Y","Z"] |