Revert "Rename _closure to _static_closure, apply naming consistently."
authorEdward Z. Yang <ezyang@cs.stanford.edu>
Mon, 20 Oct 2014 22:57:13 +0000 (15:57 -0700)
committerEdward Z. Yang <ezyang@cs.stanford.edu>
Mon, 20 Oct 2014 23:28:42 +0000 (16:28 -0700)
This reverts commit 35672072b4091d6f0031417bc160c568f22d0469.

Conflicts:
compiler/main/DriverPipeline.hs

30 files changed:
compiler/cmm/CLabel.hs
compiler/deSugar/DsForeign.lhs
compiler/ghci/ByteCodeLink.lhs
compiler/main/DriverPipeline.hs
driver/utils/dynwrapper.c
ghc/GhciMonad.hs
includes/Cmm.h
includes/Rts.h
includes/RtsAPI.h
includes/rts/StaticClosures.h [deleted file]
includes/rts/storage/ClosureMacros.h
includes/rts/storage/TSO.h
includes/stg/MiscClosures.h
libraries/integer-gmp/cbits/gmp-wrappers.cmm
rts/Exception.cmm
rts/Interpreter.c
rts/Linker.c
rts/Prelude.h
rts/PrimOps.cmm
rts/RaiseAsync.c
rts/RetainerProfile.c
rts/STM.c
rts/STM.h
rts/StgMiscClosures.cmm
rts/Weak.c
rts/package.conf.in
rts/posix/Signals.c
rts/sm/Storage.c
rts/win32/libHSbase.def
testsuite/tests/rts/rdynamic.hs

index ed2f477..c5afa09 100644 (file)
@@ -1084,7 +1084,7 @@ pprCLbl (CmmLabel _ fs CmmRet)
   = ftext fs <> ptext (sLit "_ret")
 
 pprCLbl (CmmLabel _ fs CmmClosure)
-  = ftext fs <> ptext (sLit "_static_closure")
+  = ftext fs <> ptext (sLit "_closure")
 
 pprCLbl (RtsLabel (RtsPrimOp primop))
   = ptext (sLit "stg_") <> ppr primop
@@ -1114,7 +1114,7 @@ pprCLbl (DeadStripPreventer {}) = panic "pprCLbl DeadStripPreventer"
 ppIdFlavor :: IdLabelInfo -> SDoc
 ppIdFlavor x = pp_cSEP <>
                (case x of
-                       Closure          -> ptext (sLit "static_closure")
+                       Closure          -> ptext (sLit "closure")
                        SRT              -> ptext (sLit "srt")
                        InfoTable        -> ptext (sLit "info")
                        LocalInfoTable   -> ptext (sLit "info")
index 94ae779..c60e914 100644 (file)
@@ -598,7 +598,7 @@ mkFExportCBits dflags c_nm maybe_target arg_htys res_hty is_IO_res_ty cc
   the_cfun
      = case maybe_target of
           Nothing    -> text "(StgClosure*)deRefStablePtr(the_stableptr)"
-          Just hs_fn -> text "STATIC_CLOSURE(" <> ppr hs_fn <> text ")"
+          Just hs_fn -> char '&' <> ppr hs_fn <> text "_closure"
 
   cap = text "cap" <> comma
 
@@ -623,7 +623,7 @@ mkFExportCBits dflags c_nm maybe_target arg_htys res_hty is_IO_res_ty cc
   extern_decl
      = case maybe_target of
           Nothing -> empty
-          Just hs_fn -> text "extern StgClosure " <> ppr hs_fn <> text "_static_closure" <> semi
+          Just hs_fn -> text "extern StgClosure " <> ppr hs_fn <> text "_closure" <> semi
 
 
   -- finally, the whole darn thing
@@ -679,7 +679,7 @@ foreignExportInitialiser hs_fn =
          <> text "() __attribute__((constructor));"
     , text "static void stginit_export_" <> ppr hs_fn <> text "()"
     , braces (text "foreignExportStablePtr"
-       <> parens (text "(StgPtr) &" <> ppr hs_fn <> text "_static_closure")
+       <> parens (text "(StgPtr) &" <> ppr hs_fn <> text "_closure")
        <> semi)
     ]
 
index 9656dfb..dc0ed60 100644 (file)
@@ -203,7 +203,7 @@ lookupStaticPtr addr_of_label_string
 
 lookupPrimOp :: PrimOp -> IO HValue
 lookupPrimOp primop
-   = do let sym_to_find = primopToCLabel primop "static_closure"
+   = do let sym_to_find = primopToCLabel primop "closure"
         m <- lookupSymbol sym_to_find
         case m of
            Just (Ptr addr) -> case addrToAny# addr of
@@ -216,7 +216,7 @@ lookupName ce nm
         Just (_,aa) -> return aa
         Nothing
            -> ASSERT2(isExternalName nm, ppr nm)
-              do let sym_to_find = nameToCLabel nm "static_closure"
+              do let sym_to_find = nameToCLabel nm "closure"
                  m <- lookupSymbol sym_to_find
                  case m of
                     Just (Ptr addr) -> case addrToAny# addr of
index 1977f0e..43f31e6 100644 (file)
@@ -1600,7 +1600,7 @@ mkExtraObjToLinkIntoBinary dflags = do
    | gopt Opt_NoHsMain dflags = Outputable.empty
    | otherwise = vcat [
       text "#include \"Rts.h\"",
-      text "extern StgClosure ZCMain_main_static_closure;",
+      text "extern StgClosure ZCMain_main_closure;",
       text "int main(int argc, char *argv[])",
       char '{',
       text " RtsConfig __conf = defaultRtsConfig;",
@@ -1611,7 +1611,7 @@ mkExtraObjToLinkIntoBinary dflags = do
          Just opts -> ptext (sLit "    __conf.rts_opts= ") <>
                         text (show opts) <> semi,
       text " __conf.rts_hs_main = rtsTrue;",
-      text " return hs_main(argc,argv,&ZCMain_main_static_closure,__conf);",
+      text " return hs_main(argc,argv,&ZCMain_main_closure,__conf);",
       char '}',
       char '\n' -- final newline, to keep gcc happy
      ]
index 84888e1..a9250f5 100644 (file)
@@ -188,7 +188,7 @@ int main(int argc, char *argv[]) {
     hRtsDll = GetNonNullModuleHandle(rtsDll);
 
     hs_main_p    = GetNonNullProcAddress(hRtsDll,  "hs_main");
-    main_p       = GetNonNullProcAddress(hProgDll, "ZCMain_main_static_closure");
+    main_p       = GetNonNullProcAddress(hProgDll, "ZCMain_main_closure");
     rts_config.rts_opts_enabled = rtsOpts;
     rts_config.rts_opts = NULL;
 
index d2e08cf..89c2028 100644 (file)
@@ -374,9 +374,9 @@ initInterpBuffering = do -- make sure these are linked
         -- ToDo: we should really look up these names properly, but
         -- it's a fiddle and not all the bits are exposed via the GHC
         -- interface.
-      mb_stdin_ptr  <- ObjLink.lookupSymbol "base_GHCziIOziHandleziFD_stdin_static_closure"
-      mb_stdout_ptr <- ObjLink.lookupSymbol "base_GHCziIOziHandleziFD_stdout_static_closure"
-      mb_stderr_ptr <- ObjLink.lookupSymbol "base_GHCziIOziHandleziFD_stderr_static_closure"
+      mb_stdin_ptr  <- ObjLink.lookupSymbol "base_GHCziIOziHandleziFD_stdin_closure"
+      mb_stdout_ptr <- ObjLink.lookupSymbol "base_GHCziIOziHandleziFD_stdout_closure"
+      mb_stderr_ptr <- ObjLink.lookupSymbol "base_GHCziIOziHandleziFD_stderr_closure"
 
       let f ref (Just ptr) = writeIORef ref ptr
           f _   Nothing    = panic "interactiveUI:setBuffering2"
index 1a6ea78..802ab51 100644 (file)
    -------------------------------------------------------------------------- */
 
 #include "rts/Constants.h"
-#include "rts/StaticClosures.h"
 #include "DerivedConstants.h"
 #include "rts/storage/ClosureTypes.h"
 #include "rts/storage/FunTypes.h"
index 5348e73..6bf7650 100644 (file)
@@ -193,7 +193,6 @@ INLINE_HEADER Time fsecondsToTime (double t)
 
 /* Global constaints */
 #include "rts/Constants.h"
-#include "rts/StaticClosures.h"
 
 /* Profiling information */
 #include "rts/prof/CCS.h"
index fc7eb26..0ba1671 100644 (file)
@@ -249,15 +249,15 @@ void rts_done (void);
 //      the base package itself.
 //
 #if defined(COMPILING_WINDOWS_DLL) && !defined(COMPILING_BASE_PACKAGE)
-__declspec(dllimport) extern StgWord base_GHCziTopHandler_runIO_static_closure[];
-__declspec(dllimport) extern StgWord base_GHCziTopHandler_runNonIO_static_closure[];
+__declspec(dllimport) extern StgWord base_GHCziTopHandler_runIO_closure[];
+__declspec(dllimport) extern StgWord base_GHCziTopHandler_runNonIO_closure[];
 #else
-extern StgWord base_GHCziTopHandler_runIO_static_closure[];
-extern StgWord base_GHCziTopHandler_runNonIO_static_closure[];
+extern StgWord base_GHCziTopHandler_runIO_closure[];
+extern StgWord base_GHCziTopHandler_runNonIO_closure[];
 #endif
 
-#define runIO_closure     STATIC_CLOSURE(base_GHCziTopHandler_runIO)
-#define runNonIO_closure  STATIC_CLOSURE(base_GHCziTopHandler_runNonIO)
+#define runIO_closure     base_GHCziTopHandler_runIO_closure
+#define runNonIO_closure  base_GHCziTopHandler_runNonIO_closure
 
 /* ------------------------------------------------------------------------ */
 
diff --git a/includes/rts/StaticClosures.h b/includes/rts/StaticClosures.h
deleted file mode 100644 (file)
index e6a00ac..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/* -----------------------------------------------------------------------------
- *
- * (c) The GHC Team, 1998-2009
- *
- * _closure macros for static closures, which will properly handle
- * indirection.
- *
- * NB: THIS FILE IS INCLUDED IN NON-C CODE AND DATA!  #defines only please.
- *
- * To understand the structure of the RTS headers, see the wiki:
- *   http://hackage.haskell.org/trac/ghc/wiki/Commentary/SourceTree/Includes
- *
- * ---------------------------------------------------------------------------*/
-
-#ifndef RTS_STATIC_CLOSURES_H
-#define RTS_STATIC_CLOSURES_H
-
-#if CMINUSMINUS
-#define STATIC_CLOSURE(clos) clos ## _static_closure
-#else
-#define STATIC_CLOSURE(clos) (StgClosure*)(&(clos ## _static_closure))
-#endif
-
-#define stg_END_TSO_QUEUE_closure STATIC_CLOSURE(stg_END_TSO_QUEUE)
-#define stg_STM_AWOKEN_closure STATIC_CLOSURE(stg_STM_AWOKEN)
-#define stg_NO_FINALIZER_closure STATIC_CLOSURE(stg_NO_FINALIZER)
-#define stg_dummy_ret_closure STATIC_CLOSURE(stg_dummy_ret)
-#define stg_forceIO_closure STATIC_CLOSURE(stg_forceIO)
-#define stg_END_STM_WATCH_QUEUE_closure STATIC_CLOSURE(stg_END_STM_WATCH_QUEUE)
-#define stg_END_INVARIANT_CHECK_QUEUE_closure STATIC_CLOSURE(stg_END_INVARIANT_CHECK_QUEUE)
-#define stg_END_STM_CHUNK_LIST_closure STATIC_CLOSURE(stg_END_STM_CHUNK_LIST)
-#define stg_NO_TREC_closure STATIC_CLOSURE(stg_NO_TREC)
-
-#endif /* RTS_STATIC_CLOSURES_H */
index ea7905c..64e549a 100644 (file)
@@ -187,12 +187,11 @@ INLINE_HEADER StgClosure *STATIC_LINK2(const StgInfoTable *info,
    INTLIKE and CHARLIKE closures.
    -------------------------------------------------------------------------- */
 
-// XXX update me for indirection
 INLINE_HEADER P_ CHARLIKE_CLOSURE(int n) {
-    return (P_)&stg_CHARLIKE_static_closure[(n)-MIN_CHARLIKE];
+    return (P_)&stg_CHARLIKE_closure[(n)-MIN_CHARLIKE];
 }
 INLINE_HEADER P_ INTLIKE_CLOSURE(int n) {
-    return (P_)&stg_INTLIKE_static_closure[(n)-MIN_INTLIKE];
+    return (P_)&stg_INTLIKE_closure[(n)-MIN_INTLIKE];
 }
 
 /* ----------------------------------------------------------------------------
index ad8dae6..6dbcec2 100644 (file)
@@ -252,6 +252,6 @@ void dirty_STACK (Capability *cap, StgStack *stack);
  ---------------------------------------------------------------------------- */
 
 /* this is the NIL ptr for a TSO queue (e.g. runnable queue) */
-#define END_TSO_QUEUE  ((StgTSO *)stg_END_TSO_QUEUE_closure)
+#define END_TSO_QUEUE  ((StgTSO *)(void*)&stg_END_TSO_QUEUE_closure)
 
 #endif /* RTS_STORAGE_TSO_H */
index 9b4949f..6fd7181 100644 (file)
 #  define RTS_FUN_INFO(i)   extern W_(i)[]
 #  define RTS_THUNK_INFO(i) extern W_(i)[]
 #  define RTS_INFO(i)       extern W_(i)[]
-#  define RTS_CLOSURE(i)    extern W_(i ## _static_closure)[]
+#  define RTS_CLOSURE(i)    extern W_(i)[]
 #  define RTS_FUN_DECL(f)   extern DLL_IMPORT_RTS StgFunPtr f(void)
 #else
 #  define RTS_RET_INFO(i)   extern DLL_IMPORT_RTS const StgRetInfoTable i
 #  define RTS_FUN_INFO(i)   extern DLL_IMPORT_RTS const StgFunInfoTable i
 #  define RTS_THUNK_INFO(i) extern DLL_IMPORT_RTS const StgThunkInfoTable i
 #  define RTS_INFO(i)       extern DLL_IMPORT_RTS const StgInfoTable i
-#  define RTS_CLOSURE(i)    extern DLL_IMPORT_RTS StgClosure i ## _static_closure
+#  define RTS_CLOSURE(i)    extern DLL_IMPORT_RTS StgClosure i
 #  define RTS_FUN_DECL(f)   extern DLL_IMPORT_RTS StgFunPtr f(void)
 #endif
 
@@ -148,25 +148,25 @@ RTS_ENTRY(stg_NO_TREC);
 
 /* closures */
 
-RTS_CLOSURE(stg_END_TSO_QUEUE);
-RTS_CLOSURE(stg_STM_AWOKEN);
-RTS_CLOSURE(stg_NO_FINALIZER);
-RTS_CLOSURE(stg_dummy_ret);
-RTS_CLOSURE(stg_forceIO);
+RTS_CLOSURE(stg_END_TSO_QUEUE_closure);
+RTS_CLOSURE(stg_STM_AWOKEN_closure);
+RTS_CLOSURE(stg_NO_FINALIZER_closure);
+RTS_CLOSURE(stg_dummy_ret_closure);
+RTS_CLOSURE(stg_forceIO_closure);
 
-RTS_CLOSURE(stg_END_STM_WATCH_QUEUE);
-RTS_CLOSURE(stg_END_INVARIANT_CHECK_QUEUE);
-RTS_CLOSURE(stg_END_STM_CHUNK_LIST);
-RTS_CLOSURE(stg_NO_TREC);
+RTS_CLOSURE(stg_END_STM_WATCH_QUEUE_closure);
+RTS_CLOSURE(stg_END_INVARIANT_CHECK_QUEUE_closure);
+RTS_CLOSURE(stg_END_STM_CHUNK_LIST_closure);
+RTS_CLOSURE(stg_NO_TREC_closure);
 
 RTS_ENTRY(stg_NO_FINALIZER_entry);
 
 #if IN_STG_CODE
-extern DLL_IMPORT_RTS StgWordArray stg_CHARLIKE_static_closure;
-extern DLL_IMPORT_RTS StgWordArray stg_INTLIKE_static_closure;
+extern DLL_IMPORT_RTS StgWordArray stg_CHARLIKE_closure;
+extern DLL_IMPORT_RTS StgWordArray stg_INTLIKE_closure;
 #else
-extern DLL_IMPORT_RTS StgIntCharlikeClosure stg_CHARLIKE_static_closure[];
-extern DLL_IMPORT_RTS StgIntCharlikeClosure stg_INTLIKE_static_closure[];
+extern DLL_IMPORT_RTS StgIntCharlikeClosure stg_CHARLIKE_closure[];
+extern DLL_IMPORT_RTS StgIntCharlikeClosure stg_INTLIKE_closure[];
 #endif
 
 /* StgStartup */
index f28520a..a565251 100644 (file)
@@ -74,7 +74,7 @@ import "integer-gmp" __gmpz_export;
 
 import "integer-gmp" integer_cbits_decodeDouble;
 
-import "rts" stg_INTLIKE_static_closure;
+import "rts" stg_INTLIKE_closure;
 
 /* -----------------------------------------------------------------------------
    Arbitrary-precision Integer operations.
@@ -94,7 +94,7 @@ import "rts" stg_INTLIKE_static_closure;
    dummy value is needed, the 'ByteArray#' is not supposed to be
    accessed anyway, this is should be a tolerable hack.
  */
-#define DUMMY_BYTE_ARR (stg_INTLIKE_static_closure+1)
+#define DUMMY_BYTE_ARR (stg_INTLIKE_closure+1)
 
 /* set mpz_t from Int#/ByteArray# */
 #define MP_INT_SET_FROM_BA(mp_ptr,i,ba)                  \
index 8533e3e..bc55911 100644 (file)
@@ -13,7 +13,7 @@
 #include "Cmm.h"
 #include "RaiseAsync.h"
 
-import ghczmprim_GHCziTypes_True_static_closure;
+import ghczmprim_GHCziTypes_True_closure;
 
 /* -----------------------------------------------------------------------------
    Exception Primitives
@@ -527,8 +527,8 @@ retry_pop_stack:
             Sp(5) = exception;
             Sp(4) = stg_raise_ret_info;
             Sp(3) = exception;             // the AP_STACK
-            Sp(2) = STATIC_CLOSURE(ghczmprim_GHCziTypes_True); // dummy breakpoint info
-            Sp(1) = STATIC_CLOSURE(ghczmprim_GHCziTypes_True); // True <=> a breakpoint
+            Sp(2) = ghczmprim_GHCziTypes_True_closure; // dummy breakpoint info
+            Sp(1) = ghczmprim_GHCziTypes_True_closure; // True <=> a breakpoint
             R1 = ioAction;
             jump RET_LBL(stg_ap_pppv) [R1];
         }
index 6fe1fca..f4fe816 100644 (file)
@@ -879,7 +879,7 @@ run_BCO:
                   new_aps = (StgAP_STACK *) allocate(cap, AP_STACK_sizeW(size_words));
                   SET_HDR(new_aps,&stg_AP_STACK_info,CCS_SYSTEM); 
                   new_aps->size = size_words;
-                  new_aps->fun = stg_dummy_ret_closure;
+                  new_aps->fun = &stg_dummy_ret_closure; 
 
                   // fill in the payload of the AP_STACK 
                   new_aps->payload[0] = (StgClosure *)&stg_apply_interp_info;
index aa44330..4ab7cc5 100644 (file)
@@ -1044,8 +1044,8 @@ typedef struct _RtsSymbolVal {
 #define RTS_INTCHAR_SYMBOLS
 #else
 #define RTS_INTCHAR_SYMBOLS                             \
-      SymI_HasProto(stg_CHARLIKE_static_closure)               \
-      SymI_HasProto(stg_INTLIKE_static_closure)
+      SymI_HasProto(stg_CHARLIKE_closure)               \
+      SymI_HasProto(stg_INTLIKE_closure)
 #endif
 
 
index b2f9d99..0c54148 100644 (file)
  */
 #if IN_STG_CODE
 #define PRELUDE_INFO(i)       extern W_(i)[]
-#define PRELUDE_CLOSURE(i)    extern W_(i ## _static_closure)[]
+#define PRELUDE_CLOSURE(i)    extern W_(i)[]
 #else
 #define PRELUDE_INFO(i)       extern const StgInfoTable DLL_IMPORT_DATA_VARNAME(i)
-#define PRELUDE_CLOSURE(i)    extern StgClosure DLL_IMPORT_DATA_VARNAME(i ## _static_closure)
+#define PRELUDE_CLOSURE(i)    extern StgClosure DLL_IMPORT_DATA_VARNAME(i)
 #endif
 
 /* Define canonical names so we can abstract away from the actual
  * modules these names are defined in.
  */
 
-PRELUDE_CLOSURE(ghczmprim_GHCziTypes_True);
-PRELUDE_CLOSURE(ghczmprim_GHCziTypes_False);
-PRELUDE_CLOSURE(base_GHCziPack_unpackCString);
-PRELUDE_CLOSURE(base_GHCziWeak_runFinalizzerBatch);
+PRELUDE_CLOSURE(ghczmprim_GHCziTypes_True_closure);
+PRELUDE_CLOSURE(ghczmprim_GHCziTypes_False_closure);
+PRELUDE_CLOSURE(base_GHCziPack_unpackCString_closure);
+PRELUDE_CLOSURE(base_GHCziWeak_runFinalizzerBatch_closure);
 
 #ifdef IN_STG_CODE
-extern W_ ZCMain_main_static_closure[];
+extern W_ ZCMain_main_closure[];
 #else
-extern StgClosure ZCMain_main_static_closure;
+extern StgClosure ZCMain_main_closure;
 #endif
 
-PRELUDE_CLOSURE(base_GHCziIOziException_stackOverflow);
-PRELUDE_CLOSURE(base_GHCziIOziException_heapOverflow);
-PRELUDE_CLOSURE(base_GHCziIOziException_blockedIndefinitelyOnThrowTo);
-PRELUDE_CLOSURE(base_GHCziIOziException_blockedIndefinitelyOnMVar);
-PRELUDE_CLOSURE(base_GHCziIOziException_blockedIndefinitelyOnSTM);
-PRELUDE_CLOSURE(base_ControlziExceptionziBase_nonTermination);
-PRELUDE_CLOSURE(base_ControlziExceptionziBase_nestedAtomically);
-PRELUDE_CLOSURE(base_GHCziEventziThread_blockedOnBadFD);
+PRELUDE_CLOSURE(base_GHCziIOziException_stackOverflow_closure);
+PRELUDE_CLOSURE(base_GHCziIOziException_heapOverflow_closure);
+PRELUDE_CLOSURE(base_GHCziIOziException_blockedIndefinitelyOnThrowTo_closure);
+PRELUDE_CLOSURE(base_GHCziIOziException_blockedIndefinitelyOnMVar_closure);
+PRELUDE_CLOSURE(base_GHCziIOziException_blockedIndefinitelyOnSTM_closure);
+PRELUDE_CLOSURE(base_ControlziExceptionziBase_nonTermination_closure);
+PRELUDE_CLOSURE(base_ControlziExceptionziBase_nestedAtomically_closure);
+PRELUDE_CLOSURE(base_GHCziEventziThread_blockedOnBadFD_closure);
 
-PRELUDE_CLOSURE(base_GHCziConcziSync_runSparks);
-PRELUDE_CLOSURE(base_GHCziConcziIO_ensureIOManagerIsRunning);
-PRELUDE_CLOSURE(base_GHCziConcziIO_ioManagerCapabilitiesChanged);
-PRELUDE_CLOSURE(base_GHCziConcziSignal_runHandlers);
+PRELUDE_CLOSURE(base_GHCziConcziSync_runSparks_closure);
+PRELUDE_CLOSURE(base_GHCziConcziIO_ensureIOManagerIsRunning_closure);
+PRELUDE_CLOSURE(base_GHCziConcziIO_ioManagerCapabilitiesChanged_closure);
+PRELUDE_CLOSURE(base_GHCziConcziSignal_runHandlers_closure);
 
-PRELUDE_CLOSURE(base_GHCziTopHandler_flushStdHandles);
+PRELUDE_CLOSURE(base_GHCziTopHandler_flushStdHandles_closure);
 
 PRELUDE_INFO(ghczmprim_GHCziTypes_Czh_static_info);
 PRELUDE_INFO(ghczmprim_GHCziTypes_Izh_static_info);
@@ -86,30 +86,26 @@ PRELUDE_INFO(base_GHCziWord_W64zh_con_info);
 PRELUDE_INFO(base_GHCziStable_StablePtr_static_info);
 PRELUDE_INFO(base_GHCziStable_StablePtr_con_info);
 
-#define mainIO_closure            (STATIC_CLOSURE(ZCMain_main))
-
-// XXX update me
-#define IMPORT_CLOSURE(name) DLL_IMPORT_DATA_REF(name ## _static_closure)
-
-#define True_closure              IMPORT_CLOSURE(ghczmprim_GHCziTypes_True)
-#define False_closure             IMPORT_CLOSURE(ghczmprim_GHCziTypes_False)
-#define unpackCString_closure     IMPORT_CLOSURE(base_GHCziPack_unpackCString)
-#define runFinalizerBatch_closure IMPORT_CLOSURE(base_GHCziWeak_runFinalizzerBatch)
-
-#define runSparks_closure         IMPORT_CLOSURE(base_GHCziConcziSync_runSparks)
-#define ensureIOManagerIsRunning_closure IMPORT_CLOSURE(base_GHCziConcziIO_ensureIOManagerIsRunning)
-#define ioManagerCapabilitiesChanged_closure IMPORT_CLOSURE(base_GHCziConcziIO_ioManagerCapabilitiesChanged)
-#define runHandlers_closure       IMPORT_CLOSURE(base_GHCziConcziSignal_runHandlers)
-
-#define flushStdHandles_closure   IMPORT_CLOSURE(base_GHCziTopHandler_flushStdHandles)
-
-#define stackOverflow_closure     IMPORT_CLOSURE(base_GHCziIOziException_stackOverflow)
-#define heapOverflow_closure      IMPORT_CLOSURE(base_GHCziIOziException_heapOverflow)
-#define blockedIndefinitelyOnMVar_closure IMPORT_CLOSURE(base_GHCziIOziException_blockedIndefinitelyOnMVar)
-#define blockedIndefinitelyOnSTM_closure IMPORT_CLOSURE(base_GHCziIOziException_blockedIndefinitelyOnSTM)
-#define nonTermination_closure    IMPORT_CLOSURE(base_ControlziExceptionziBase_nonTermination)
-#define nestedAtomically_closure  IMPORT_CLOSURE(base_ControlziExceptionziBase_nestedAtomically)
-#define blockedOnBadFD_closure    IMPORT_CLOSURE(base_GHCziEventziThread_blockedOnBadFD)
+#define True_closure              DLL_IMPORT_DATA_REF(ghczmprim_GHCziTypes_True_closure)
+#define False_closure             DLL_IMPORT_DATA_REF(ghczmprim_GHCziTypes_False_closure)
+#define unpackCString_closure     DLL_IMPORT_DATA_REF(base_GHCziPack_unpackCString_closure)
+#define runFinalizerBatch_closure DLL_IMPORT_DATA_REF(base_GHCziWeak_runFinalizzerBatch_closure)
+#define mainIO_closure            (&ZCMain_main_closure)
+
+#define runSparks_closure         DLL_IMPORT_DATA_REF(base_GHCziConcziSync_runSparks_closure)
+#define ensureIOManagerIsRunning_closure DLL_IMPORT_DATA_REF(base_GHCziConcziIO_ensureIOManagerIsRunning_closure)
+#define ioManagerCapabilitiesChanged_closure DLL_IMPORT_DATA_REF(base_GHCziConcziIO_ioManagerCapabilitiesChanged_closure)
+#define runHandlers_closure       DLL_IMPORT_DATA_REF(base_GHCziConcziSignal_runHandlers_closure)
+
+#define flushStdHandles_closure   DLL_IMPORT_DATA_REF(base_GHCziTopHandler_flushStdHandles_closure)
+
+#define stackOverflow_closure     DLL_IMPORT_DATA_REF(base_GHCziIOziException_stackOverflow_closure)
+#define heapOverflow_closure      DLL_IMPORT_DATA_REF(base_GHCziIOziException_heapOverflow_closure)
+#define blockedIndefinitelyOnMVar_closure DLL_IMPORT_DATA_REF(base_GHCziIOziException_blockedIndefinitelyOnMVar_closure)
+#define blockedIndefinitelyOnSTM_closure DLL_IMPORT_DATA_REF(base_GHCziIOziException_blockedIndefinitelyOnSTM_closure)
+#define nonTermination_closure    DLL_IMPORT_DATA_REF(base_ControlziExceptionziBase_nonTermination_closure)
+#define nestedAtomically_closure  DLL_IMPORT_DATA_REF(base_ControlziExceptionziBase_nestedAtomically_closure)
+#define blockedOnBadFD_closure    DLL_IMPORT_DATA_REF(base_GHCziEventziThread_blockedOnBadFD_closure)
 
 #define Czh_static_info           DLL_IMPORT_DATA_REF(ghczmprim_GHCziTypes_Czh_static_info)
 #define Fzh_static_info           DLL_IMPORT_DATA_REF(ghczmprim_GHCziTypes_Fzh_static_info)
index a0e744b..16c91e9 100644 (file)
@@ -31,7 +31,7 @@ import pthread_mutex_unlock;
 import base_ControlziExceptionziBase_nestedAtomically_static_closure;
 import EnterCriticalSection;
 import LeaveCriticalSection;
-import ghczmprim_GHCziTypes_False_static_closure;
+import ghczmprim_GHCziTypes_False_closure;
 #if defined(USE_MINIINTERPRETER) || !defined(mingw32_HOST_OS)
 import sm_mutex;
 #endif
@@ -1171,7 +1171,7 @@ stg_atomicallyzh (P_ stm)
 
     /* Nested transactions are not allowed; raise an exception */
     if (old_trec != NO_TREC) {
-        jump stg_raisezh(STATIC_CLOSURE(base_ControlziExceptionziBase_nestedAtomically));
+        jump stg_raisezh(base_ControlziExceptionziBase_nestedAtomically_closure);
     }
 
     code = stm;
@@ -2342,13 +2342,13 @@ stg_getSparkzh ()
     W_ spark;
 
 #ifndef THREADED_RTS
-    return (0,STATIC_CLOSURE(ghczmprim_GHCziTypes_False));
+    return (0,ghczmprim_GHCziTypes_False_closure);
 #else
     (spark) = ccall findSpark(MyCapability());
     if (spark != 0) {
         return (1,spark);
     } else {
-        return (0,STATIC_CLOSURE(ghczmprim_GHCziTypes_False));
+        return (0,ghczmprim_GHCziTypes_False_closure);
     }
 #endif
 }
index 8485e48..a5440e4 100644 (file)
@@ -776,7 +776,7 @@ raiseAsync(Capability *cap, StgTSO *tso, StgClosure *exception,
        sp++;
     } else {
        sp--;
-       sp[0] = (W_)stg_dummy_ret_closure;
+       sp[0] = (W_)&stg_dummy_ret_closure;
     }
 
     frame = sp + 1;
@@ -957,7 +957,7 @@ raiseAsync(Capability *cap, StgTSO *tso, StgClosure *exception,
                 // ATOMICALLY_FRAME instance for condemned
                 // transactions, but I don't fully understand the
                 // interaction with STM invariants.
-                stack->sp[1] = (W_)stg_NO_TREC_closure;
+                stack->sp[1] = (W_)&stg_NO_TREC_closure;
                 stack->sp[0] = (W_)&stg_ret_p_info;
                 tso->what_next = ThreadRunGHC;
                 goto done;
index 86d20a8..bfc9624 100644 (file)
@@ -1748,7 +1748,7 @@ retainRoot(void *user STG_UNUSED, StgClosure **tl)
 
     c = UNTAG_CLOSURE(*tl);
     maybeInitRetainerSet(c);
-    if (c != stg_END_TSO_QUEUE_closure && isRetainer(c)) {
+    if (c != &stg_END_TSO_QUEUE_closure && isRetainer(c)) {
        retainClosure(c, c, getRetainerFrom(c));
     } else {
        retainClosure(c, c, CCS_SYSTEM);
index 8b80536..cf97e7b 100644 (file)
--- a/rts/STM.c
+++ b/rts/STM.c
@@ -386,11 +386,11 @@ static void unpark_tso(Capability *cap, StgTSO *tso) {
     // future.
     lockTSO(tso);
     if (tso->why_blocked == BlockedOnSTM &&
-        tso->block_info.closure == stg_STM_AWOKEN_closure) {
+        tso->block_info.closure == &stg_STM_AWOKEN_closure) {
       TRACE("unpark_tso already woken up tso=%p", tso);
     } else if (tso -> why_blocked == BlockedOnSTM) {
       TRACE("unpark_tso on tso=%p", tso);
-      tso->block_info.closure = stg_STM_AWOKEN_closure;
+      tso->block_info.closure = &stg_STM_AWOKEN_closure;
       tryWakeupThread(cap,tso);
     } else {
       TRACE("spurious unpark_tso on tso=%p", tso);
index 8bfa24f..ffec009 100644 (file)
--- a/rts/STM.h
+++ b/rts/STM.h
@@ -209,11 +209,11 @@ void stmWriteTVar(Capability *cap,
 
 /* NULLs */
 
-#define END_STM_WATCH_QUEUE ((StgTVarWatchQueue *)stg_END_STM_WATCH_QUEUE_closure)
-#define END_INVARIANT_CHECK_QUEUE ((StgInvariantCheckQueue *)stg_END_INVARIANT_CHECK_QUEUE_closure)
-#define END_STM_CHUNK_LIST ((StgTRecChunk *)stg_END_STM_CHUNK_LIST_closure)
+#define END_STM_WATCH_QUEUE ((StgTVarWatchQueue *)(void *)&stg_END_STM_WATCH_QUEUE_closure)
+#define END_INVARIANT_CHECK_QUEUE ((StgInvariantCheckQueue *)(void *)&stg_END_INVARIANT_CHECK_QUEUE_closure)
+#define END_STM_CHUNK_LIST ((StgTRecChunk *)(void *)&stg_END_STM_CHUNK_LIST_closure)
 
-#define NO_TREC ((StgTRecHeader *)stg_NO_TREC_closure)
+#define NO_TREC ((StgTRecHeader *)(void *)&stg_NO_TREC_closure)
 
 /*----------------------------------------------------------------------*/
 
index e546dd5..85ecb5e 100644 (file)
@@ -682,7 +682,7 @@ INFO_TABLE_CONSTR(stg_MVAR_TSO_QUEUE,2,0,0,PRIM,"MVAR_TSO_QUEUE","MVAR_TSO_QUEUE
 
 #if !(defined(COMPILING_WINDOWS_DLL))
 section "data" {
- stg_CHARLIKE_static_closure:
+ stg_CHARLIKE_closure:
     CHARLIKE_HDR(0)
     CHARLIKE_HDR(1)
     CHARLIKE_HDR(2)
@@ -942,7 +942,7 @@ section "data" {
 }
 
 section "data" {
- stg_INTLIKE_static_closure:
+ stg_INTLIKE_closure:
     INTLIKE_HDR(-16) /* MIN_INTLIKE == -16 */
     INTLIKE_HDR(-15)
     INTLIKE_HDR(-14)
index 3890dfb..f8faa4e 100644 (file)
@@ -21,7 +21,7 @@ runCFinalizers(StgCFinalizerList *list)
 {
     StgCFinalizerList *head;
     for (head = list;
-        (StgClosure *)head != stg_NO_FINALIZER_closure;
+        (StgClosure *)head != &stg_NO_FINALIZER_closure;
         head = (StgCFinalizerList *)head->link)
     {
         if (head->flag)
@@ -88,7 +88,7 @@ scheduleFinalizers(Capability *cap, StgWeak *list)
         // collector removes DEAD_WEAKs from the weak pointer list.
         ASSERT(w->header.info != &stg_DEAD_WEAK_info);
 
-        if (w->finalizer != stg_NO_FINALIZER_closure) {
+        if (w->finalizer != &stg_NO_FINALIZER_closure) {
             n++;
         }
 
@@ -124,7 +124,7 @@ scheduleFinalizers(Capability *cap, StgWeak *list)
 
     n = 0;
     for (w = list; w; w = w->link) {
-        if (w->finalizer != stg_NO_FINALIZER_closure) {
+        if (w->finalizer != &stg_NO_FINALIZER_closure) {
             arr->payload[n] = w->finalizer;
             n++;
         }
index 7569732..82d2870 100644 (file)
@@ -91,24 +91,24 @@ ld-options:
          , "-Wl,-u,_base_GHCziPtr_Ptr_con_info"
          , "-Wl,-u,_base_GHCziPtr_FunPtr_con_info"
          , "-Wl,-u,_base_GHCziStable_StablePtr_con_info"
-         , "-Wl,-u,_ghczmprim_GHCziTypes_False_static_closure"
-         , "-Wl,-u,_ghczmprim_GHCziTypes_True_static_closure"
-         , "-Wl,-u,_base_GHCziPack_unpackCString_static_closure"
-         , "-Wl,-u,_base_GHCziIOziException_stackOverflow_static_closure"
-         , "-Wl,-u,_base_GHCziIOziException_heapOverflow_static_closure"
-         , "-Wl,-u,_base_ControlziExceptionziBase_nonTermination_static_closure"
-         , "-Wl,-u,_base_GHCziIOziException_blockedIndefinitelyOnMVar_static_closure"
-         , "-Wl,-u,_base_GHCziIOziException_blockedIndefinitelyOnSTM_static_closure"
-         , "-Wl,-u,_base_ControlziExceptionziBase_nestedAtomically_static_closure"
-         , "-Wl,-u,_base_GHCziEventziThread_blockedOnBadFD_static_closure"
-         , "-Wl,-u,_base_GHCziWeak_runFinalizzerBatch_static_closure"
-         , "-Wl,-u,_base_GHCziTopHandler_flushStdHandles_static_closure"
-         , "-Wl,-u,_base_GHCziTopHandler_runIO_static_closure"
-         , "-Wl,-u,_base_GHCziTopHandler_runNonIO_static_closure"
-         , "-Wl,-u,_base_GHCziConcziIO_ensureIOManagerIsRunning_static_closure"
-         , "-Wl,-u,_base_GHCziConcziIO_ioManagerCapabilitiesChanged_static_closure"
-         , "-Wl,-u,_base_GHCziConcziSync_runSparks_static_closure"
-         , "-Wl,-u,_base_GHCziConcziSignal_runHandlers_static_closure"
+         , "-Wl,-u,_ghczmprim_GHCziTypes_False_closure"
+         , "-Wl,-u,_ghczmprim_GHCziTypes_True_closure"
+         , "-Wl,-u,_base_GHCziPack_unpackCString_closure"
+         , "-Wl,-u,_base_GHCziIOziException_stackOverflow_closure"
+         , "-Wl,-u,_base_GHCziIOziException_heapOverflow_closure"
+         , "-Wl,-u,_base_ControlziExceptionziBase_nonTermination_closure"
+         , "-Wl,-u,_base_GHCziIOziException_blockedIndefinitelyOnMVar_closure"
+         , "-Wl,-u,_base_GHCziIOziException_blockedIndefinitelyOnSTM_closure"
+         , "-Wl,-u,_base_ControlziExceptionziBase_nestedAtomically_closure"
+         , "-Wl,-u,_base_GHCziEventziThread_blockedOnBadFD_closure"
+         , "-Wl,-u,_base_GHCziWeak_runFinalizzerBatch_closure"
+         , "-Wl,-u,_base_GHCziTopHandler_flushStdHandles_closure"
+         , "-Wl,-u,_base_GHCziTopHandler_runIO_closure"
+         , "-Wl,-u,_base_GHCziTopHandler_runNonIO_closure"
+         , "-Wl,-u,_base_GHCziConcziIO_ensureIOManagerIsRunning_closure"
+         , "-Wl,-u,_base_GHCziConcziIO_ioManagerCapabilitiesChanged_closure"
+         , "-Wl,-u,_base_GHCziConcziSync_runSparks_closure"
+         , "-Wl,-u,_base_GHCziConcziSignal_runHandlers_closure"
 #else
            "-Wl,-u,ghczmprim_GHCziTypes_Izh_static_info"
          , "-Wl,-u,ghczmprim_GHCziTypes_Czh_static_info"
@@ -132,24 +132,24 @@ ld-options:
          , "-Wl,-u,base_GHCziPtr_Ptr_con_info"
          , "-Wl,-u,base_GHCziPtr_FunPtr_con_info"
          , "-Wl,-u,base_GHCziStable_StablePtr_con_info"
-         , "-Wl,-u,ghczmprim_GHCziTypes_False_static_closure"
-         , "-Wl,-u,ghczmprim_GHCziTypes_True_static_closure"
-         , "-Wl,-u,base_GHCziPack_unpackCString_static_closure"
-         , "-Wl,-u,base_GHCziIOziException_stackOverflow_static_closure"
-         , "-Wl,-u,base_GHCziIOziException_heapOverflow_static_closure"
-         , "-Wl,-u,base_ControlziExceptionziBase_nonTermination_static_closure"
-         , "-Wl,-u,base_GHCziIOziException_blockedIndefinitelyOnMVar_static_closure"
-         , "-Wl,-u,base_GHCziIOziException_blockedIndefinitelyOnSTM_static_closure"
-         , "-Wl,-u,base_ControlziExceptionziBase_nestedAtomically_static_closure"
-         , "-Wl,-u,base_GHCziEventziThread_blockedOnBadFD_static_closure"
-         , "-Wl,-u,base_GHCziWeak_runFinalizzerBatch_static_closure"
-         , "-Wl,-u,base_GHCziTopHandler_flushStdHandles_static_closure"
-         , "-Wl,-u,base_GHCziTopHandler_runIO_static_closure"
-         , "-Wl,-u,base_GHCziTopHandler_runNonIO_static_closure"
-         , "-Wl,-u,base_GHCziConcziIO_ensureIOManagerIsRunning_static_closure"
-         , "-Wl,-u,base_GHCziConcziIO_ioManagerCapabilitiesChanged_static_closure"
-         , "-Wl,-u,base_GHCziConcziSync_runSparks_static_closure"
-         , "-Wl,-u,base_GHCziConcziSignal_runHandlers_static_closure"
+         , "-Wl,-u,ghczmprim_GHCziTypes_False_closure"
+         , "-Wl,-u,ghczmprim_GHCziTypes_True_closure"
+         , "-Wl,-u,base_GHCziPack_unpackCString_closure"
+         , "-Wl,-u,base_GHCziIOziException_stackOverflow_closure"
+         , "-Wl,-u,base_GHCziIOziException_heapOverflow_closure"
+         , "-Wl,-u,base_ControlziExceptionziBase_nonTermination_closure"
+         , "-Wl,-u,base_GHCziIOziException_blockedIndefinitelyOnMVar_closure"
+         , "-Wl,-u,base_GHCziIOziException_blockedIndefinitelyOnSTM_closure"
+         , "-Wl,-u,base_ControlziExceptionziBase_nestedAtomically_closure"
+         , "-Wl,-u,base_GHCziEventziThread_blockedOnBadFD_closure"
+         , "-Wl,-u,base_GHCziWeak_runFinalizzerBatch_closure"
+         , "-Wl,-u,base_GHCziTopHandler_flushStdHandles_closure"
+         , "-Wl,-u,base_GHCziTopHandler_runIO_closure"
+         , "-Wl,-u,base_GHCziTopHandler_runNonIO_closure"
+         , "-Wl,-u,base_GHCziConcziIO_ensureIOManagerIsRunning_closure"
+         , "-Wl,-u,base_GHCziConcziIO_ioManagerCapabilitiesChanged_closure"
+         , "-Wl,-u,base_GHCziConcziSync_runSparks_closure"
+         , "-Wl,-u,base_GHCziConcziSignal_runHandlers_closure"
 #endif
 
 /*  Pick up static libraries in preference over dynamic if in earlier search
index 4a86012..36a72a5 100644 (file)
@@ -193,7 +193,7 @@ ioManagerDie (void)
 void
 ioManagerStartCap (Capability **cap)
 {
-    rts_evalIO(cap,ensureIOManagerIsRunning_closure,NULL);
+    rts_evalIO(cap,&base_GHCziConcziIO_ensureIOManagerIsRunning_closure,NULL);
 }
 
 void
@@ -473,7 +473,7 @@ startSignalHandlers(Capability *cap)
           RtsFlags.GcFlags.initialStkSize,
               rts_apply(cap,
                   rts_apply(cap,
-                      runHandlers_closure,
+                      &base_GHCziConcziSignal_runHandlers_closure,
                       rts_mkPtr(cap, info)),
                   rts_mkInt(cap, info->si_signo))));
   }
index 1a0aff0..379d9da 100644 (file)
@@ -115,8 +115,8 @@ initStorage (void)
    */
   /* We use the NOT_NULL variant or gcc warns that the test is always true */
   ASSERT(LOOKS_LIKE_INFO_PTR_NOT_NULL((StgWord)&stg_BLOCKING_QUEUE_CLEAN_info));
-  ASSERT(LOOKS_LIKE_CLOSURE_PTR(stg_dummy_ret_closure));
-  ASSERT(!HEAP_ALLOCED(stg_dummy_ret_closure));
+  ASSERT(LOOKS_LIKE_CLOSURE_PTR(&stg_dummy_ret_closure));
+  ASSERT(!HEAP_ALLOCED(&stg_dummy_ret_closure));
   
   if (RtsFlags.GcFlags.maxHeapSize != 0 &&
       RtsFlags.GcFlags.heapSizeSuggestion > 
index 4d1375a..8140528 100644 (file)
@@ -15,29 +15,29 @@ EXPORTS
 
        base_GHCziStable_StablePtr_con_info
 
-       base_GHCziPack_unpackCString_static_closure
+       base_GHCziPack_unpackCString_closure
 
-       base_GHCziTopHandler_runIO_static_closure
-       base_GHCziTopHandler_runNonIO_static_closure
+       base_GHCziTopHandler_runIO_closure
+       base_GHCziTopHandler_runNonIO_closure
 
-       base_GHCziIOziException_stackOverflow_static_closure
-       base_GHCziIOziException_heapOverflow_static_closure
+       base_GHCziIOziException_stackOverflow_closure
+       base_GHCziIOziException_heapOverflow_closure
 
        base_GHCziPtr_Ptr_con_info
        base_GHCziPtr_FunPtr_con_info
 
-       base_GHCziConcziIO_ensureIOManagerIsRunning_static_closure
-       base_GHCziConcziIO_ioManagerCapabilitiesChanged_static_closure
-       base_GHCziConcziSync_runSparks_static_closure
+       base_GHCziConcziIO_ensureIOManagerIsRunning_closure
+       base_GHCziConcziIO_ioManagerCapabilitiesChanged_closure
+       base_GHCziConcziSync_runSparks_closure
 
-       base_GHCziTopHandler_flushStdHandles_static_closure
+       base_GHCziTopHandler_flushStdHandles_closure
 
-       base_GHCziWeak_runFinalizzerBatch_static_closure
-       base_GHCziPack_unpackCString_static_closure
-       base_GHCziIOziException_blockedIndefinitelyOnMVar_static_closure
-       base_GHCziIOziException_blockedIndefinitelyOnSTM_static_closure
-       base_GHCziIOziException_stackOverflow_static_closure
+       base_GHCziWeak_runFinalizzerBatch_closure
+       base_GHCziPack_unpackCString_closure
+       base_GHCziIOziException_blockedIndefinitelyOnMVar_closure
+       base_GHCziIOziException_blockedIndefinitelyOnSTM_closure
+       base_GHCziIOziException_stackOverflow_closure
 
-       base_ControlziExceptionziBase_nonTermination_static_closure
-       base_ControlziExceptionziBase_nestedAtomically_static_closure
-       base_GHCziEventziThread_blockedOnBadFD_static_closure
+       base_ControlziExceptionziBase_nonTermination_closure
+       base_ControlziExceptionziBase_nestedAtomically_closure
+       base_GHCziEventziThread_blockedOnBadFD_closure
index ebd079f..5fb4651 100644 (file)
@@ -29,7 +29,7 @@ loadFunction mpkg m valsym = do
     let symbol = prefixUnderscore
                    ++ maybe "" (\p -> zEncodeString p ++ "_") mpkg
                    ++ zEncodeString m ++ "_" ++ zEncodeString valsym
-                   ++ "_static_closure"
+                   ++ "_closure"
     ptr@(Ptr addr) <- withCString symbol c_lookupSymbol
     if (ptr == nullPtr)
     then return Nothing