summaryrefslogtreecommitdiff
path: root/rts/Prelude.h
diff options
context:
space:
mode:
authorEdward Z. Yang <ezyang@mit.edu>2013-08-26 15:23:15 -0700
committerEdward Z. Yang <ezyang@cs.stanford.edu>2014-10-01 22:26:39 -0700
commit35672072b4091d6f0031417bc160c568f22d0469 (patch)
tree243925bae6f8869cca1df8595c17c0467b9d5998 /rts/Prelude.h
parent178eb9060f369b216f3f401196e28eab4af5624d (diff)
downloadhaskell-35672072b4091d6f0031417bc160c568f22d0469.tar.gz
Rename _closure to _static_closure, apply naming consistently.
Summary: In preparation for indirecting all references to closures, we rename _closure to _static_closure to ensure any old code will get an undefined symbol error. In order to reference a closure foobar_closure (which is now undefined), you should instead use STATIC_CLOSURE(foobar). For convenience, a number of these old identifiers are macro'd. Across C-- and C (Windows and otherwise), there were differing conventions on whether or not foobar_closure or &foobar_closure was the address of the closure. Now, all foobar_closure references are addresses, and no & is necessary. CHARLIKE/INTLIKE were not changed, simply alpha-renamed. Part of remove HEAP_ALLOCED patch set (#8199) Depends on D265 Signed-off-by: Edward Z. Yang <ezyang@mit.edu> Test Plan: validate Reviewers: simonmar, austin Subscribers: simonmar, ezyang, carter, thomie Differential Revision: https://phabricator.haskell.org/D267 GHC Trac Issues: #8199
Diffstat (limited to 'rts/Prelude.h')
-rw-r--r--rts/Prelude.h86
1 files changed, 45 insertions, 41 deletions
diff --git a/rts/Prelude.h b/rts/Prelude.h
index 0c54148ba2..b2f9d994e7 100644
--- a/rts/Prelude.h
+++ b/rts/Prelude.h
@@ -14,42 +14,42 @@
*/
#if IN_STG_CODE
#define PRELUDE_INFO(i) extern W_(i)[]
-#define PRELUDE_CLOSURE(i) extern W_(i)[]
+#define PRELUDE_CLOSURE(i) extern W_(i ## _static_closure)[]
#else
#define PRELUDE_INFO(i) extern const StgInfoTable DLL_IMPORT_DATA_VARNAME(i)
-#define PRELUDE_CLOSURE(i) extern StgClosure DLL_IMPORT_DATA_VARNAME(i)
+#define PRELUDE_CLOSURE(i) extern StgClosure DLL_IMPORT_DATA_VARNAME(i ## _static_closure)
#endif
/* Define canonical names so we can abstract away from the actual
* modules these names are defined in.
*/
-PRELUDE_CLOSURE(ghczmprim_GHCziTypes_True_closure);
-PRELUDE_CLOSURE(ghczmprim_GHCziTypes_False_closure);
-PRELUDE_CLOSURE(base_GHCziPack_unpackCString_closure);
-PRELUDE_CLOSURE(base_GHCziWeak_runFinalizzerBatch_closure);
+PRELUDE_CLOSURE(ghczmprim_GHCziTypes_True);
+PRELUDE_CLOSURE(ghczmprim_GHCziTypes_False);
+PRELUDE_CLOSURE(base_GHCziPack_unpackCString);
+PRELUDE_CLOSURE(base_GHCziWeak_runFinalizzerBatch);
#ifdef IN_STG_CODE
-extern W_ ZCMain_main_closure[];
+extern W_ ZCMain_main_static_closure[];
#else
-extern StgClosure ZCMain_main_closure;
+extern StgClosure ZCMain_main_static_closure;
#endif
-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_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_GHCziConcziSync_runSparks_closure);
-PRELUDE_CLOSURE(base_GHCziConcziIO_ensureIOManagerIsRunning_closure);
-PRELUDE_CLOSURE(base_GHCziConcziIO_ioManagerCapabilitiesChanged_closure);
-PRELUDE_CLOSURE(base_GHCziConcziSignal_runHandlers_closure);
+PRELUDE_CLOSURE(base_GHCziConcziSync_runSparks);
+PRELUDE_CLOSURE(base_GHCziConcziIO_ensureIOManagerIsRunning);
+PRELUDE_CLOSURE(base_GHCziConcziIO_ioManagerCapabilitiesChanged);
+PRELUDE_CLOSURE(base_GHCziConcziSignal_runHandlers);
-PRELUDE_CLOSURE(base_GHCziTopHandler_flushStdHandles_closure);
+PRELUDE_CLOSURE(base_GHCziTopHandler_flushStdHandles);
PRELUDE_INFO(ghczmprim_GHCziTypes_Czh_static_info);
PRELUDE_INFO(ghczmprim_GHCziTypes_Izh_static_info);
@@ -86,26 +86,30 @@ PRELUDE_INFO(base_GHCziWord_W64zh_con_info);
PRELUDE_INFO(base_GHCziStable_StablePtr_static_info);
PRELUDE_INFO(base_GHCziStable_StablePtr_con_info);
-#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 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 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)