Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC

Commits:

5 changed files:

Changes:

  • changelog.d/unit-index
    1 1
     section: compiler
    
    2 2
     synopsis: Use global ``UnitIndex`` to deduplicate ``UnitInfo``s over multiple home units
    
    3
    -issues: #27500 #26423 #27748 #27834
    
    4
    -mrs: !16115 !16598 !16743
    
    3
    +issues: #27500 #26423 #27748 #27834 #27835
    
    4
    +mrs: !16115 !16598 !16743 !16748
    
    5 5
     
    
    6 6
     description: {
    
    7 7
         The ``UnitState`` used to be duplicated for all ``HomeUnitEnv``, not sharing any of the ``UnitInfo``s.
    

  • compiler/GHC/Driver/Backpack.hs
    ... ... @@ -441,9 +441,11 @@ addInMemoryDatabase dflags u = do
    441 441
               }
    
    442 442
         let uic = hscUIC hsc_env
    
    443 443
         liftIO $ cacheExternalUnitDatabase uic newdb
    
    444
    -    -- added at the end because ordering matters
    
    444
    +    -- Ordering matters here! We prepend the new unit database, because 'packageDBFlags'
    
    445
    +    -- works like a stack, where what's on top takes precedence over what's below (same as right-to-left when given at the CLI).
    
    446
    +    -- The new db needs highest precedence to overwrite any other in-memory units that potentially occur in the dbs below it.
    
    445 447
         pure dflags
    
    446
    -          { packageDBFlags = packageDBFlags dflags ++ [PackageDB (PkgDbPath (unitDatabasePath newdb))]
    
    448
    +          { packageDBFlags = PackageDB (PkgDbPath (unitDatabasePath newdb)) : packageDBFlags dflags
    
    447 449
               }
    
    448 450
     
    
    449 451
     -- | Register a new virtual unit database containing a single unit
    

  • testsuite/tests/backpack/should_compile/T27835.bkp
    1
    +unit p where
    
    2
    +  module P where
    
    3
    +    p :: Int
    
    4
    +    p = 42
    
    5
    +
    
    6
    +unit q where
    
    7
    +  dependency p
    
    8
    +  module Q where
    
    9
    +    import P
    
    10
    +    q :: Int
    
    11
    +    q = p + 1

  • testsuite/tests/backpack/should_compile/T27835.stderr
    1
    +[1 of 2] Processing p
    
    2
    +  Instantiating p
    
    3
    +  [1 of 1] Compiling P                ( p/P.hs, T27835.out/p/P.o )
    
    4
    +[2 of 2] Processing q
    
    5
    +  Instantiating q
    
    6
    +  [1 of 1] Including p
    
    7
    +  [1 of 1] Compiling Q                ( q/Q.hs, T27835.out/q/Q.o )

  • testsuite/tests/backpack/should_compile/all.T
    ... ... @@ -61,3 +61,4 @@ test('T13250', normal, backpack_compile, [''])
    61 61
     test('T13323', normal, backpack_compile, [''])
    
    62 62
     test('T20396', normal, backpack_compile, [''])
    
    63 63
     test('T23424', [ignore_stdout, ignore_stderr], backpack_compile, ['-ddump-rn-trace -ddump-if-trace -ddump-tc-trace'])
    
    64
    +test('T27835', normal, backpack_compile, ['-clear-package-db -global-package-db'])