From: simonpj Date: Wed, 11 Dec 2002 12:02:15 +0000 (+0000) Subject: [project @ 2002-12-11 12:02:15 by simonpj] X-Git-Tag: Approx_11550_changesets_converted~1368 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=49f5cb281586159f1081dc65c65c38189e3fd0b6;p=ghc-hetmet.git [project @ 2002-12-11 12:02:15 by simonpj] Behave decently if there are NoStubs in ForeignStubs --- diff --git a/ghc/compiler/codeGen/CodeGen.lhs b/ghc/compiler/codeGen/CodeGen.lhs index 5198897..f690ffc 100644 --- a/ghc/compiler/codeGen/CodeGen.lhs +++ b/ghc/compiler/codeGen/CodeGen.lhs @@ -112,33 +112,37 @@ mkModuleInit -> AbstractC mkModuleInit way cost_centre_info (ModGuts { mg_module = mod, - mg_foreign = ForeignStubs _ _ _ fe_binders, + mg_foreign = for_stubs, mg_dir_imps = imported_modules }) = let - register_fes = - map (\f -> CMacroStmt REGISTER_FOREIGN_EXPORT [f]) fe_labels + (cc_decls, cc_regs) = mkCostCentreStuff cost_centre_info - fe_labels = - map (\f -> CLbl (mkClosureLabel (idName f)) PtrRep) fe_binders + register_foreign_exports + = case for_stubs of + NoStubs -> [] + ForeignStubs _ _ _ fe_bndrs -> map mk_export_register fe_bndrs - (cc_decls, cc_regs) = mkCostCentreStuff cost_centre_info + mk_export_register bndr + = CMacroStmt REGISTER_FOREIGN_EXPORT [lbl] + where + lbl = CLbl (mkClosureLabel (idName bndr)) PtrRep + -- we don't want/need to init GHC.Prim, so filter it out - -- we don't want/need to init GHC.Prim, so filter it out mk_import_register mod | mod == gHC_PRIM = AbsCNop | otherwise = CMacroStmt REGISTER_IMPORT [ CLbl (mkModuleInitLabel mod way) AddrRep ] - register_imports = map mk_import_register imported_modules + register_mod_imports = map mk_import_register imported_modules in mkAbstractCs [ cc_decls, CModuleInitBlock (mkPlainModuleInitLabel mod) (mkModuleInitLabel mod way) - (mkAbstractCs (register_fes ++ + (mkAbstractCs (register_foreign_exports ++ cc_regs : - register_imports)) + register_mod_imports)) ] \end{code}