[commit: ghc] wip/ttypeable: Mark KindReps as noinline (cbe7dac)

git at git.haskell.org git at git.haskell.org
Mon Feb 13 15:16:46 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/ttypeable
Link       : http://ghc.haskell.org/trac/ghc/changeset/cbe7dac78618b7ef4ac382c68e69c2f9aa8d3044/ghc

>---------------------------------------------------------------

commit cbe7dac78618b7ef4ac382c68e69c2f9aa8d3044
Author: Ben Gamari <ben at smart-cactus.org>
Date:   Sun Feb 12 09:18:43 2017 -0500

    Mark KindReps as noinline


>---------------------------------------------------------------

cbe7dac78618b7ef4ac382c68e69c2f9aa8d3044
 compiler/basicTypes/MkId.hs      | 2 +-
 compiler/typecheck/TcTypeable.hs | 8 +++++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/compiler/basicTypes/MkId.hs b/compiler/basicTypes/MkId.hs
index 65860d9..8a204be 100644
--- a/compiler/basicTypes/MkId.hs
+++ b/compiler/basicTypes/MkId.hs
@@ -31,7 +31,7 @@ module MkId (
         voidPrimId, voidArgId,
         nullAddrId, seqId, lazyId, lazyIdKey, runRWId,
         coercionTokenId, magicDictId, coerceId,
-        proxyHashId, noinlineIdName,
+        proxyHashId, noinlineId, noinlineIdName,
 
         -- Re-export error Ids
         module PrelRules
diff --git a/compiler/typecheck/TcTypeable.hs b/compiler/typecheck/TcTypeable.hs
index 1676b76..247dc6d 100644
--- a/compiler/typecheck/TcTypeable.hs
+++ b/compiler/typecheck/TcTypeable.hs
@@ -22,6 +22,7 @@ import TysPrim ( primTyCons )
 import TysWiredIn ( tupleTyCon, sumTyCon, runtimeRepTyCon
                   , vecCountTyCon, vecElemTyCon
                   , nilDataCon, consDataCon )
+import MkId ( noinlineId )
 import Id
 import Type
 import Kind ( isTYPEApp )
@@ -396,13 +397,18 @@ mkTyConRepTyConRHS :: TypeableStuff -> TypeRepTodo
                    -> TcRn (LHsExpr Id)
 mkTyConRepTyConRHS stuff@(Stuff {..}) todo tycon tycon_kind
   = do kind_rep <- mkTyConKindRep stuff tycon tycon_kind
+       -- We mark kind reps as noinline as they tend to get floated
+       -- out and consequently blow up interface file sizes.
+       let kind_rep' = mkLHsWrap (mkWpTyApps [mkTyConTy kindRepTyCon])
+                                 (nlHsVar noinlineId)
+                       `nlHsApp` kind_rep
        let rep_rhs = nlHsDataCon trTyConDataCon
                      `nlHsApp` nlHsLit (word64 dflags high)
                      `nlHsApp` nlHsLit (word64 dflags low)
                      `nlHsApp` mod_rep_expr todo
                      `nlHsApp` trNameLit (mkFastString tycon_str)
                      `nlHsApp` nlHsLit (int n_kind_vars)
-                     `nlHsApp` kind_rep
+                     `nlHsApp` kind_rep'
        return rep_rhs
   where
     n_kind_vars = length $ filter isNamedTyConBinder (tyConBinders tycon)



More information about the ghc-commits mailing list