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
        ManyConstru...
    9edcb1fb