summaryrefslogtreecommitdiff
path: root/rts/Globals.c
diff options
context:
space:
mode:
authorMoritz Angermann <moritz.angermann@gmail.com>2016-11-29 16:50:32 -0500
committerBen Gamari <ben@smart-cactus.org>2016-11-29 16:50:33 -0500
commit6f7ed1e51bf360621a3c2a447045ab3012f68575 (patch)
treef6e047df820dce2a049ead7927c1b36e95b2bfdd /rts/Globals.c
parent795f8bd460d604c792a5df8cfec937b2a74c3956 (diff)
downloadhaskell-6f7ed1e51bf360621a3c2a447045ab3012f68575.tar.gz
Make globals use sharedCAF
The use of globals is quite painful when multiple rts are loaded, e.g. when plugins are loaded, which bring in a second rts. The sharedCAF appraoch was employed for the FastStringTable; I've taken the libery to extend this to the other globals I could find. Reviewers: rwbarton, simonmar, austin, hvr, erikd, bgamari Reviewed By: simonmar, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2575
Diffstat (limited to 'rts/Globals.c')
-rw-r--r--rts/Globals.c79
1 files changed, 25 insertions, 54 deletions
diff --git a/rts/Globals.c b/rts/Globals.c
index 4b899b15ba..b5da6d9295 100644
--- a/rts/Globals.c
+++ b/rts/Globals.c
@@ -13,7 +13,7 @@
* dynamically loads
*
* libHSghc - a statically-linked ghc has its own copy and so will Core
- * plugins it dynamically loads (cf CoreMonad.reinitializeGlobals)
+ * plugins it dynamically loads.
*
* ---------------------------------------------------------------------------*/
@@ -33,6 +33,11 @@ typedef enum {
SystemTimerThreadEventManagerStore,
SystemTimerThreadIOManagerThreadStore,
LibHSghcFastStringTable,
+ LibHSghcPersistentLinkerState,
+ LibHSghcInitLinkerDone,
+ LibHSghcGlobalDynFlags,
+ LibHSghcStaticOptions,
+ LibHSghcStaticOptionsReady,
MaxStoreKey
} StoreKey;
@@ -85,58 +90,24 @@ static StgStablePtr getOrSetKey(StoreKey key, StgStablePtr ptr)
#endif
}
return ret;
-}
-
-StgStablePtr
-getOrSetGHCConcSignalSignalHandlerStore(StgStablePtr ptr)
-{
- return getOrSetKey(GHCConcSignalSignalHandlerStore,ptr);
}
-StgStablePtr
-getOrSetGHCConcWindowsPendingDelaysStore(StgStablePtr ptr)
-{
- return getOrSetKey(GHCConcWindowsPendingDelaysStore,ptr);
-}
-
-StgStablePtr
-getOrSetGHCConcWindowsIOManagerThreadStore(StgStablePtr ptr)
-{
- return getOrSetKey(GHCConcWindowsIOManagerThreadStore,ptr);
-}
-
-StgStablePtr
-getOrSetGHCConcWindowsProddingStore(StgStablePtr ptr)
-{
- return getOrSetKey(GHCConcWindowsProddingStore,ptr);
-}
-
-StgStablePtr
-getOrSetSystemEventThreadEventManagerStore(StgStablePtr ptr)
-{
- return getOrSetKey(SystemEventThreadEventManagerStore,ptr);
-}
-
-StgStablePtr
-getOrSetSystemEventThreadIOManagerThreadStore(StgStablePtr ptr)
-{
- return getOrSetKey(SystemEventThreadIOManagerThreadStore,ptr);
-}
-
-StgStablePtr
-getOrSetSystemTimerThreadEventManagerStore(StgStablePtr ptr)
-{
- return getOrSetKey(SystemTimerThreadEventManagerStore,ptr);
-}
-
-StgStablePtr
-getOrSetSystemTimerThreadIOManagerThreadStore(StgStablePtr ptr)
-{
- return getOrSetKey(SystemTimerThreadIOManagerThreadStore,ptr);
-}
-
-StgStablePtr
-getOrSetLibHSghcFastStringTable(StgStablePtr ptr)
-{
- return getOrSetKey(LibHSghcFastStringTable,ptr);
-}
+#define mkStoreAccessor(name) \
+ StgStablePtr \
+ getOrSet##name(StgStablePtr ptr) \
+ { return getOrSetKey(name, ptr); }
+
+mkStoreAccessor(GHCConcSignalSignalHandlerStore)
+mkStoreAccessor(GHCConcWindowsPendingDelaysStore)
+mkStoreAccessor(GHCConcWindowsIOManagerThreadStore)
+mkStoreAccessor(GHCConcWindowsProddingStore)
+mkStoreAccessor(SystemEventThreadEventManagerStore)
+mkStoreAccessor(SystemEventThreadIOManagerThreadStore)
+mkStoreAccessor(SystemTimerThreadEventManagerStore)
+mkStoreAccessor(SystemTimerThreadIOManagerThreadStore)
+mkStoreAccessor(LibHSghcFastStringTable)
+mkStoreAccessor(LibHSghcPersistentLinkerState)
+mkStoreAccessor(LibHSghcInitLinkerDone)
+mkStoreAccessor(LibHSghcGlobalDynFlags)
+mkStoreAccessor(LibHSghcStaticOptions)
+mkStoreAccessor(LibHSghcStaticOptionsReady)