Hannes Siebenhandl pushed to branch wip/fendor/external-unit-db-cache at Glasgow Haskell Compiler / GHC

Commits:

1 changed file:

Changes:

  • compiler/GHC/Unit/External/Index.hs
    1
    +-- | The 'UnitIndex' is a 'UnitEnv' wide data structure that shares
    
    2
    +-- external unit information across the 'UnitState' of all home units
    
    3
    +-- (e.g., 'HomeUnitEnv') in a particular 'UnitEnv'.
    
    4
    +--
    
    5
    +-- It caches already read unit databases, all processed 'UnitInfo's and
    
    6
    +-- the 'WireMap'.
    
    7
    +--
    
    8
    +-- This module is meant to be imported as @Index@.
    
    9
    +--
    
    10
    +-- A short overview of how the different types here related to 'UnitState', 'UnitEnv'
    
    11
    +-- and the 'HomeUnitEnv'.
    
    12
    +--
    
    13
    +-- ┌─────────┐
    
    14
    +-- │ UnitEnv │
    
    15
    +-- └────┬────┘
    
    16
    +--      ├───────────────────────┐
    
    17
    +--      │                       │
    
    18
    +-- ┌────▼──────┐          ┌─────▼─────┐
    
    19
    +-- │HomeUnitEnv│          │ UnitIndex ├────────────────┐
    
    20
    +-- └────┬──────┘          └───────────┘                │
    
    21
    +--      │                                              │
    
    22
    +--      │      Reads cached unit DBs                   │
    
    23
    +-- ┌────▼──────┐          ┌─────────────────────┐      │
    
    24
    +-- │ UnitState ├──────────>ExternalUnitDatabases◄──────┤
    
    25
    +-- └────┬──┬───┘          └─────────────────────┘      │
    
    26
    +--      │  └───────────────────────┐                   │
    
    27
    +--      │   Writes new UnitInfos   │                   │
    
    28
    +--      │   during initialisation  │                   │
    
    29
    +-- ┌────▼────────┐        ┌────────v──────────┐        │
    
    30
    +-- │ UnitInfoMap │        │ GlobalUnitInfoMap ◄────────┘
    
    31
    +-- └────┬────────┘        └────────^──────────┘
    
    32
    +--      │                          │
    
    33
    +--      └──────────────────────────┘
    
    34
    +--          UnitInfoMap references
    
    35
    +--          GlobalUnitInfoMap values
    
    36
    +--          (All UnitInfos are shared)
    
    37
    +--
    
    38
    +-- Open arrow @A ───> B@: A uses B.
    
    39
    +-- Closed arrow @A ◄─── B@: A is a field of B.
    
    40
    +--
    
    41
    +-- Also, see Note [Sharing 'UnitInfo's across the 'UnitEnv'] for more technical discussion
    
    42
    +-- about sharing 'UnitInfo's.
    
    1 43
     module GHC.Unit.External.Index (
    
    2 44
       -- * The 'UnitIndexCache'.
    
    3 45
       -- A mutable wrapper around 'UnitIndex'