diff options
author | simonpj <unknown> | 2002-12-11 12:02:15 +0000 |
---|---|---|
committer | simonpj <unknown> | 2002-12-11 12:02:15 +0000 |
commit | 49f5cb281586159f1081dc65c65c38189e3fd0b6 (patch) | |
tree | fa1f7537eb65f94f88c152478f60b192eb94f1ba | |
parent | 62bcbe780c51da5ce7bb08f70b08c7cafd7b2e7a (diff) | |
download | haskell-49f5cb281586159f1081dc65c65c38189e3fd0b6.tar.gz |
[project @ 2002-12-11 12:02:15 by simonpj]
Behave decently if there are NoStubs in ForeignStubs
-rw-r--r-- | ghc/compiler/codeGen/CodeGen.lhs | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/ghc/compiler/codeGen/CodeGen.lhs b/ghc/compiler/codeGen/CodeGen.lhs index 51988973ff..f690ffc8fa 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} |