summaryrefslogtreecommitdiff
path: root/compiler/GHC/Unit/State.hs
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2020-02-11 09:41:44 +0100
committerBen Gamari <ben@smart-cactus.org>2020-06-17 16:22:03 -0400
commit96aa57878fd6e6a7b92e841a0df8b5255a559c97 (patch)
treeda1dabadf29c6b681682a4577b4ca08e29bc44a5 /compiler/GHC/Unit/State.hs
parent9f96bc127d6231b5e76bbab442244eb303b08867 (diff)
downloadhaskell-96aa57878fd6e6a7b92e841a0df8b5255a559c97.tar.gz
Update compiler
Thanks to ghc-bignum, the compiler can be simplified: * Types and constructors of Integer and Natural can be wired-in. It means that we don't have to query them from interfaces. It also means that numeric literals don't have to carry their type with them. * The same code is used whatever ghc-bignum backend is enabled. In particular, conversion of bignum literals into final Core expressions is now much more straightforward. Bignum closure inspection too. * GHC itself doesn't depend on any integer-* package anymore * The `integerLibrary` setting is gone.
Diffstat (limited to 'compiler/GHC/Unit/State.hs')
-rw-r--r--compiler/GHC/Unit/State.hs24
1 files changed, 0 insertions, 24 deletions
diff --git a/compiler/GHC/Unit/State.hs b/compiler/GHC/Unit/State.hs
index ac1b220918..aa1318ad5d 100644
--- a/compiler/GHC/Unit/State.hs
+++ b/compiler/GHC/Unit/State.hs
@@ -954,26 +954,12 @@ sortByPreference prec_map = sortBy (flip (compareByPreference prec_map))
-- Pursuant to #12518, we could change this policy to, for example, remove
-- the version preference, meaning that we would always prefer the units
-- in later unit database.
---
--- Instead, we use that preference based policy only when one of the packages
--- is integer-gmp and the other is integer-simple.
--- This currently only happens when we're looking up which concrete
--- package to use in place of @integer-wired-in@ and that two different
--- package databases supply a different integer library. For more about
--- the fake @integer-wired-in@ package, see Note [The integer library]
--- in the @GHC.Builtin.Names@ module.
compareByPreference
:: UnitPrecedenceMap
-> UnitInfo
-> UnitInfo
-> Ordering
compareByPreference prec_map pkg pkg'
- | Just prec <- Map.lookup (unitId pkg) prec_map
- , Just prec' <- Map.lookup (unitId pkg') prec_map
- , differentIntegerPkgs pkg pkg'
- = compare prec prec'
-
- | otherwise
= case comparing unitPackageVersion pkg pkg' of
GT -> GT
EQ | Just prec <- Map.lookup (unitId pkg) prec_map
@@ -985,12 +971,6 @@ compareByPreference prec_map pkg pkg'
-> EQ
LT -> LT
- where isIntegerPkg p = unitPackageNameString p `elem`
- ["integer-simple", "integer-gmp"]
- differentIntegerPkgs p p' =
- isIntegerPkg p && isIntegerPkg p' &&
- (unitPackageName p /= unitPackageName p')
-
comparing :: Ord a => (t -> a) -> t -> t -> Ordering
comparing f a b = f a `compare` f b
@@ -1054,10 +1034,6 @@ findWiredInUnits printer prec_map pkgs vis_map = do
-- in Note [Wired-in units] in GHC.Unit.Module
let
matches :: UnitInfo -> UnitId -> Bool
- pc `matches` pid
- -- See Note [The integer library] in GHC.Builtin.Names
- | pid == integerUnitId
- = unitPackageNameString pc `elem` ["integer-gmp", "integer-simple"]
pc `matches` pid = unitPackageName pc == PackageName (unitIdFS pid)
-- find which package corresponds to each wired-in package