X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;ds=sidebyside;f=compiler%2Fiface%2FMkIface.lhs;h=5c236b306f362d18af1614316b4f9a67b34af47d;hb=a90dc3907a491bfb478262441534b24fb0eb22f4;hp=1c34edca3ce19ab44b751f025c77215a430144f7;hpb=b84ba676034763b3082bbd9405794a4fde499d14;p=ghc-hetmet.git diff --git a/compiler/iface/MkIface.lhs b/compiler/iface/MkIface.lhs index 1c34edc..5c236b3 100644 --- a/compiler/iface/MkIface.lhs +++ b/compiler/iface/MkIface.lhs @@ -83,7 +83,7 @@ import Digraph import SrcLoc import Outputable import BasicTypes hiding ( SuccessFlag(..) ) -import LazyUniqFM +import UniqFM import Unique import Util hiding ( eqListBy ) import FiniteMap @@ -164,9 +164,8 @@ mkUsedNames TcGblEnv{ tcg_inst_uses = dfun_uses_var, tcg_dus = dus } - = do - dfun_uses <- readIORef dfun_uses_var -- What dfuns are used - return (allUses dus `unionNameSets` dfun_uses) + = do { dfun_uses <- readIORef dfun_uses_var -- What dfuns are used + ; return (allUses dus `unionNameSets` dfun_uses) } mkDependencies :: TcGblEnv -> IO Dependencies mkDependencies @@ -512,7 +511,12 @@ addFingerprints hsc_env mb_old_fingerprint iface0 new_decls -- the export list hash doesn't depend on the fingerprints of -- the Names it mentions, only the Names themselves, hence putNameLiterally. export_hash <- computeFingerprint dflags putNameLiterally - (mi_exports iface0, orphan_hash, dep_orphan_hashes) + (mi_exports iface0, + orphan_hash, + dep_orphan_hashes, + dep_pkgs (mi_deps iface0)) + -- dep_pkgs: see "Package Version Changes" on + -- wiki/Commentary/Compiler/RecompilationAvoidance -- put the declarations in a canonical order, sorted by OccName let sorted_decls = eltsFM $ listToFM $ @@ -656,6 +660,24 @@ freeNamesDeclExtras IfaceOtherDeclExtras freeNamesSub :: (Fixity,[IfaceRule]) -> NameSet freeNamesSub (_,rules) = unionManyNameSets (map freeNamesIfRule rules) +instance Outputable IfaceDeclExtras where + ppr IfaceOtherDeclExtras = empty + ppr (IfaceIdExtras fix rules) = ppr_id_extras fix rules + ppr (IfaceSynExtras fix) = ppr fix + ppr (IfaceDataExtras fix insts stuff) = vcat [ppr fix, ppr_insts insts, + ppr_id_extras_s stuff] + ppr (IfaceClassExtras fix insts stuff) = vcat [ppr fix, ppr_insts insts, + ppr_id_extras_s stuff] + +ppr_insts :: [IfaceInstABI] -> SDoc +ppr_insts _ = ptext (sLit "") + +ppr_id_extras_s :: [(Fixity, [IfaceRule])] -> SDoc +ppr_id_extras_s stuff = vcat [ppr_id_extras f r | (f,r)<- stuff] + +ppr_id_extras :: Fixity -> [IfaceRule] -> SDoc +ppr_id_extras fix rules = ppr fix $$ vcat (map ppr rules) + -- This instance is used only to compute fingerprints instance Binary IfaceDeclExtras where get _bh = panic "no get for IfaceDeclExtras" @@ -833,7 +855,7 @@ mk_usage_info pit hsc_env this_mod direct_imports used_names | isWiredInName name = mv_map -- ignore wired-in names | otherwise = case nameModule_maybe name of - Nothing -> pprTrace "mkUsageInfo: internal name?" (ppr name) mv_map + Nothing -> pprPanic "mkUsageInfo: internal name?" (ppr name) Just mod -> -- We use this fiddly lambda function rather than -- (++) as the argument to extendModuleEnv_C to -- avoid quadratic behaviour (trac #2680) @@ -1311,7 +1333,7 @@ tyThingToIfaceDecl (AClass clas) toIfaceClassOp (sel_id, def_meth) = ASSERT(sel_tyvars == clas_tyvars) - IfaceClassOp (getOccName sel_id) def_meth (toIfaceType op_ty) + IfaceClassOp (getOccName sel_id) (toDmSpec def_meth) (toIfaceType op_ty) where -- Be careful when splitting the type, because of things -- like class Foo a where @@ -1321,6 +1343,10 @@ tyThingToIfaceDecl (AClass clas) (sel_tyvars, rho_ty) = splitForAllTys (idType sel_id) op_ty = funResultTy rho_ty + toDmSpec NoDefMeth = NoDM + toDmSpec GenDefMeth = GenericDM + toDmSpec (DefMeth _) = VanillaDM + toIfaceFD (tvs1, tvs2) = (map getFS tvs1, map getFS tvs2) tyThingToIfaceDecl (ATyCon tycon) @@ -1503,22 +1529,23 @@ toIfaceIdInfo id_info -------------------------- toIfUnfolding :: Bool -> Unfolding -> Maybe IfaceInfoItem -toIfUnfolding lb (CoreUnfolding { uf_tmpl = rhs, uf_arity = arity - , uf_src = src, uf_guidance = guidance }) - = case src of - InlineWrapper w -> Just (HsUnfold lb (IfWrapper arity (idName w))) - InlineRule {} -> Just (HsUnfold lb (IfInlineRule arity sat (toIfaceExpr rhs))) - _other -> Just (HsUnfold lb (IfCoreUnfold (toIfaceExpr rhs))) +toIfUnfolding lb unf@(CoreUnfolding { uf_tmpl = rhs, uf_arity = arity + , uf_src = src, uf_guidance = guidance }) + = Just $ HsUnfold lb $ + case src of + InlineRule {} + -> case guidance of + UnfWhen unsat_ok boring_ok -> IfInlineRule arity unsat_ok boring_ok (toIfaceExpr rhs) + _other -> pprPanic "toIfUnfolding" (ppr unf) + InlineWrapper w -> IfWrapper arity (idName w) + InlineCompulsory -> IfCompulsory (toIfaceExpr rhs) + InlineRhs -> IfCoreUnfold (toIfaceExpr rhs) -- Yes, even if guidance is UnfNever, expose the unfolding -- If we didn't want to expose the unfolding, TidyPgm would -- have stuck in NoUnfolding. For supercompilation we want -- to see that unfolding! - where - sat = case guidance of - UnfWhen unsat_ok _ -> unsat_ok - _other -> needSaturated -toIfUnfolding lb (DFunUnfolding _con ops) +toIfUnfolding lb (DFunUnfolding _ar _con ops) = Just (HsUnfold lb (IfDFunUnfold (map toIfaceExpr ops))) -- No need to serialise the data constructor; -- we can recover it from the type of the dfun