Skip to content
  • Jaro Reinders's avatar
    Refactor Unique to be represented by Word64 · 9edcb1fb
    Jaro Reinders authored and Marge Bot's avatar Marge Bot committed
    In #22010 we established that Int was not always sufficient to store all
    the uniques we generate during compilation on 32-bit platforms. This
    commit addresses that problem by using Word64 instead of Int for
    uniques.
    
    The core of the change is in GHC.Core.Types.Unique and
    GHC.Core.Types.Unique.Supply. However, the representation of uniques is
    used in many other places, so those needed changes too. Additionally, the RTS
    has been extended with an atomic_inc64 operation.
    
    One major change from this commit is the introduction of the Word64Set and
    Word64Map data types. These are adapted versions of IntSet and IntMap
    from the containers package. These are planned to be upstreamed in the
    future.
    
    As a natural consequence of these changes, the compiler will be a bit
    slower and take more space on 32-bit platforms. Our CI tests indicate
    around a 5% residency increase.
    
    Metric Increase:
        CoOpt_Read
        CoOpt_Singletons
        LargeRecord
        ManyAlternatives
        ManyConstructors
        MultiComponentModules
        MultiComponentModulesRecomp
        MultiLayerModulesTH_OneShot
        RecordUpdPerf
        T10421
        T10547
        T12150
        T12227
        T12234
        T12425
        T12707
        T13035
        T13056
        T13253
        T13253-spj
        T13379
        T13386
        T13719
        T14683
        T14697
        T14766
        T15164
        T15703
        T16577
        T16875
        T17516
        T18140
        T18223
        T18282
        T18304
        T18698a
        T18698b
        T18923
        T1969
        T19695
        T20049
        T21839c
        T3064
        T3294
        T4801
        T5030
        T5321FD
        T5321Fun
        T5631
        T5642
        T5837
        T6048
        T783
        T8095
        T9020
        T9198
        T9233
        T9630
        T9675
        T9872a
        T9872b
        T9872b_defer
        T9872c
        T9872d
        T9961
        TcPlugin_RewritePerf
        UniqLoop
        WWRec
        hard_hole_fits
    9edcb1fb