diff options
author | Ben Gamari <ben@smart-cactus.org> | 2021-03-08 09:51:27 -0500 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-03-17 19:07:10 -0400 |
commit | 665b757f48e8dab2bab6d68afc3748a8d8896d2f (patch) | |
tree | 73d0a70524ddd355e3d44c246ae3e9cb297677d5 /compiler/GHC/CoreToIface.hs | |
parent | d14a20686ceb508cb19284e9839b74d0480a5a46 (diff) | |
download | haskell-665b757f48e8dab2bab6d68afc3748a8d8896d2f.tar.gz |
IfaceToType: Ensure that IfaceTyConInfo is shared
In #19194 mpickering detailed that there are a LOT of allocations
of IfaceTyConInfo:
There are just two main cases: IfaceTyConInfo IsPromoted IfaceNormalTyCon
and IfaceTyConInfo NotPromoted IfaceNormalTyCon. These should be made into
CAFs and shared. From my analysis, the most common case is
IfaceTyConInfo NotPromoted IfaceNormalTyCon (53 000)
then IfaceTyConInfo IsPromoted IfaceNormalTyCon (28 000).
This patch makes it so these are properly shared by using a smart
constructor.
Fixes #19194.
Diffstat (limited to 'compiler/GHC/CoreToIface.hs')
-rw-r--r-- | compiler/GHC/CoreToIface.hs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/GHC/CoreToIface.hs b/compiler/GHC/CoreToIface.hs index 1437208925..d48686b615 100644 --- a/compiler/GHC/CoreToIface.hs +++ b/compiler/GHC/CoreToIface.hs @@ -194,7 +194,7 @@ toIfaceTypeX fr (TyConApp tc tys) | tc `elem` [ eqPrimTyCon, eqReprPrimTyCon, heqTyCon ] , (k1:k2:_) <- tys - = let info = IfaceTyConInfo NotPromoted sort + = let info = mkIfaceTyConInfo NotPromoted sort sort | k1 `eqType` k2 = IfaceEqualityTyCon | otherwise = IfaceNormalTyCon in IfaceTyConApp (IfaceTyCon (tyConName tc) info) (toIfaceTcArgsX fr tc tys) @@ -224,7 +224,7 @@ toIfaceTyCon tc = IfaceTyCon tc_name info where tc_name = tyConName tc - info = IfaceTyConInfo promoted sort + info = mkIfaceTyConInfo promoted sort promoted | isPromotedDataCon tc = IsPromoted | otherwise = NotPromoted @@ -252,7 +252,7 @@ toIfaceTyCon tc toIfaceTyCon_name :: Name -> IfaceTyCon toIfaceTyCon_name n = IfaceTyCon n info - where info = IfaceTyConInfo NotPromoted IfaceNormalTyCon + where info = mkIfaceTyConInfo NotPromoted IfaceNormalTyCon -- Used for the "rough-match" tycon stuff, -- where pretty-printing is not an issue |