summaryrefslogtreecommitdiff
path: root/rts
diff options
context:
space:
mode:
authorMoritz Angermann <moritz.angermann@gmail.com>2016-12-11 11:32:28 +0000
committerTamar Christina <tamar@zhox.com>2016-12-11 15:29:17 +0000
commitc3c702441137dc8f7ee0dd5ac313be96d625459a (patch)
treea59633ac90b97a7df7c09db560bf8030c15ebf2e /rts
parent490b9429a8ed3c55d17bf0964fb14582eb206a3d (diff)
downloadhaskell-c3c702441137dc8f7ee0dd5ac313be96d625459a.tar.gz
Make globals use sharedCAF
Summary: 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. This is a reboot of D2575, that should hopefully not exhibit the same windows build issues. Reviewers: Phyx, simonmar, goldfire, bgamari, austin, hvr, erikd Reviewed By: Phyx, simonmar, bgamari Subscribers: mpickering, thomie Differential Revision: https://phabricator.haskell.org/D2773
Diffstat (limited to 'rts')
-rw-r--r--rts/Globals.c79
-rw-r--r--rts/RtsSymbols.c5
2 files changed, 30 insertions, 54 deletions
diff --git a/rts/Globals.c b/rts/Globals.c
index e3445c8d7b..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;
@@ -87,56 +92,22 @@ static StgStablePtr getOrSetKey(StoreKey key, StgStablePtr ptr)
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)
diff --git a/rts/RtsSymbols.c b/rts/RtsSymbols.c
index 848553095b..28479fb508 100644
--- a/rts/RtsSymbols.c
+++ b/rts/RtsSymbols.c
@@ -595,6 +595,11 @@
SymI_HasProto(getOrSetLibHSghcFastStringTable) \
SymI_HasProto(getRTSStats) \
SymI_HasProto(getRTSStatsEnabled) \
+ SymI_HasProto(getOrSetLibHSghcPersistentLinkerState) \
+ SymI_HasProto(getOrSetLibHSghcInitLinkerDone) \
+ SymI_HasProto(getOrSetLibHSghcGlobalDynFlags) \
+ SymI_HasProto(getOrSetLibHSghcStaticOptions) \
+ SymI_HasProto(getOrSetLibHSghcStaticOptionsReady) \
SymI_HasProto(genericRaise) \
SymI_HasProto(getProgArgv) \
SymI_HasProto(getFullProgArgv) \