diff options
author | wolfgang <unknown> | 2005-05-18 04:02:39 +0000 |
---|---|---|
committer | wolfgang <unknown> | 2005-05-18 04:02:39 +0000 |
commit | 644e072887cab9146bf68b99092dd3ec27bc757d (patch) | |
tree | 57606b37439515ede5c58f46824a6eda81b7fd0d | |
parent | e5d225f5102baaf8b433ee3e3d8ca21e085d2534 (diff) | |
download | haskell-644e072887cab9146bf68b99092dd3ec27bc757d.tar.gz |
[project @ 2005-05-18 04:02:39 by wolfgang]
Use constructor functions instead of stginit functions on Win32, too.
(stginit functions are still used for profiling)
-rw-r--r-- | ghc/compiler/codeGen/CgClosure.lhs | 21 | ||||
-rw-r--r-- | ghc/compiler/codeGen/CodeGen.lhs | 24 | ||||
-rw-r--r-- | ghc/compiler/deSugar/DsForeign.lhs | 13 | ||||
-rw-r--r-- | ghc/rts/package.conf.in | 6 |
4 files changed, 17 insertions, 47 deletions
diff --git a/ghc/compiler/codeGen/CgClosure.lhs b/ghc/compiler/codeGen/CgClosure.lhs index 7ec8f484a6..8a0f4dd449 100644 --- a/ghc/compiler/codeGen/CgClosure.lhs +++ b/ghc/compiler/codeGen/CgClosure.lhs @@ -1,7 +1,7 @@ % % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % -% $Id: CgClosure.lhs,v 1.70 2005/05/17 13:47:39 simonmar Exp $ +% $Id: CgClosure.lhs,v 1.71 2005/05/18 04:02:39 wolfgang Exp $ % \section[CgClosure]{Code generation for closures} @@ -39,7 +39,7 @@ import SMRep ( CgRep, cgRepSizeW, argMachRep, fixedHdrSize, WordOff, import MachOp ( MachHint(..) ) import Cmm import CmmUtils ( CmmStmts, mkStmts, oneStmt, plusStmts, noStmts, - mkLblExpr ) + mkLblExpr, mkIntCLit ) import CLabel import StgSyn import StaticFlags ( opt_DoTickyProfiling ) @@ -84,8 +84,16 @@ cgTopRhsClosure id ccs binder_info srt upd_flag args body = do closure_info = mkClosureInfo True id lf_info 0 0 srt_info descr closure_label = mkLocalClosureLabel name cg_id_info = stableIdInfo id (mkLblExpr closure_label) lf_info - closure_rep = mkStaticClosureFields closure_info ccs True [] - + closure_rep | not is_caf = mkStaticClosureFields closure_info ccs True [] + | otherwise = mkStaticClosure (mkRtsInfoLabel SLIT("stg_caf")) ccs + [CmmLabel (infoTableLabelFromCI closure_info)] + [mkIntCLit 0, mkIntCLit 0] + [] [] + + is_caf = null args + && not (closureReEntrant closure_info) + && isStaticClosure closure_info + -- BUILD THE OBJECT, AND GENERATE INFO TABLE (IF NECESSARY) ; emitDataLits closure_label closure_rep ; forkClosureBody (closureCodeBody binder_info closure_info @@ -480,8 +488,9 @@ setupUpdate closure_info code ; if closureUpdReqd closure_info then do -- Blackhole the (updatable) CAF: - { upd_closure <- link_caf closure_info True - ; pushUpdateFrame upd_closure code } + code + -- { upd_closure <- link_caf closure_info True + -- ; pushUpdateFrame upd_closure code } else do { -- No update reqd, you'd think we don't need to -- black-hole it. But when ticky-ticky is on, we diff --git a/ghc/compiler/codeGen/CodeGen.lhs b/ghc/compiler/codeGen/CodeGen.lhs index 16cf251fe8..1aa48656f5 100644 --- a/ghc/compiler/codeGen/CodeGen.lhs +++ b/ghc/compiler/codeGen/CodeGen.lhs @@ -150,7 +150,7 @@ mkModuleInit -> Code mkModuleInit dflags way cost_centre_info this_mod mb_main_mod foreign_stubs imported_mods = do { - if need_init_code + if opt_SccProfilingOn then do { -- Allocate the static boolean that records if this -- module has been registered already emitData Data [CmmDataLabel moduleRegdLabel, @@ -204,10 +204,6 @@ mkModuleInit dflags way cost_centre_info this_mod mb_main_mod foreign_stubs impo stmtC (CmmStore (mkLblExpr moduleRegdLabel) (CmmLit (mkIntCLit 1))) -- Now do local stuff -#if defined(mingw32_HOST_OS) - -- ... until the GHCi Linker can load files with constructor functions: - ; registerForeignExports foreign_stubs -#endif ; initCostCentres cost_centre_info ; mapCs (registerModuleImport dflags way) (imported_mods++extra_imported_mods) @@ -218,12 +214,6 @@ mkModuleInit dflags way cost_centre_info this_mod mb_main_mod foreign_stubs impo ret_code = stmtsC [ CmmAssign spReg (cmmRegOffW spReg 1) , CmmJump (CmmLoad (cmmRegOffW spReg (-1)) wordRep) [] ] -#if defined(mingw32_HOST_OS) - need_init_code = True -#else - need_init_code = opt_SccProfilingOn -#endif - ----------------------- registerModuleImport :: DynFlags -> String -> Module -> Code registerModuleImport dflags way mod @@ -232,18 +222,6 @@ registerModuleImport dflags way mod | otherwise -- Push the init procedure onto the work stack = stmtsC [ CmmAssign spReg (cmmRegOffW spReg (-1)) , CmmStore (CmmReg spReg) (mkLblExpr (mkModuleInitLabel dflags mod way)) ] - ------------------------ -registerForeignExports :: ForeignStubs -> Code -registerForeignExports NoStubs - = nopC -registerForeignExports (ForeignStubs _ _ _ fe_bndrs) - = mapM_ mk_export_register fe_bndrs - where - mk_export_register bndr - = emitRtsCall SLIT("getStablePtr") - [ (CmmLit (CmmLabel (mkLocalClosureLabel (idName bndr))), - PtrHint) ] \end{code} diff --git a/ghc/compiler/deSugar/DsForeign.lhs b/ghc/compiler/deSugar/DsForeign.lhs index a99b354017..9f0758a4cf 100644 --- a/ghc/compiler/deSugar/DsForeign.lhs +++ b/ghc/compiler/deSugar/DsForeign.lhs @@ -540,21 +540,10 @@ mkFExportCBits c_nm maybe_target arg_htys res_hty is_IO_res_ty cc -- the program. -- (this is bad for big umbrella modules like Graphics.Rendering.OpenGL) - -- the only reason for making the mingw32 (anything targetting PE, really) stick - -- out here is that the GHCi linker isn't capable of handling .ctors sections - useStaticConstructors -#if defined(mingw32_HOST_OS) - = False -#else - = True -#endif - initialiser = case maybe_target of Nothing -> empty - Just hs_fn - | not useStaticConstructors -> empty - | otherwise -> + Just hs_fn -> vcat [ text "static void stginit_export_" <> ppr hs_fn <> text "() __attribute__((constructor));" diff --git a/ghc/rts/package.conf.in b/ghc/rts/package.conf.in index d83a6ae131..eedbfc14dd 100644 --- a/ghc/rts/package.conf.in +++ b/ghc/rts/package.conf.in @@ -99,9 +99,6 @@ ld-options: , "-u", "_GHCziIOBase_BlockedIndefinitely_closure" , "-u", "_GHCziIOBase_Deadlock_closure" , "-u", "_GHCziWeak_runFinalizzerBatch_closure" -#if defined(mingw32_HOST_OS) - , "-u", "__stginit_Prelude" -#endif #else "-u", "GHCziBase_Izh_static_info" , "-u", "GHCziBase_Czh_static_info" @@ -135,9 +132,6 @@ ld-options: , "-u", "GHCziIOBase_BlockedIndefinitely_closure" , "-u", "GHCziIOBase_Deadlock_closure" , "-u", "GHCziWeak_runFinalizzerBatch_closure" -#if defined(mingw32_HOST_OS) - , "-u", "__stginit_Prelude" -#endif #endif framework-dirs: |