diff options
author | Moritz Angermann <moritz.angermann@gmail.com> | 2016-12-11 11:32:28 +0000 |
---|---|---|
committer | Tamar Christina <tamar@zhox.com> | 2016-12-11 15:29:17 +0000 |
commit | c3c702441137dc8f7ee0dd5ac313be96d625459a (patch) | |
tree | a59633ac90b97a7df7c09db560bf8030c15ebf2e /rts/Globals.c | |
parent | 490b9429a8ed3c55d17bf0964fb14582eb206a3d (diff) | |
download | haskell-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/Globals.c')
-rw-r--r-- | rts/Globals.c | 79 |
1 files changed, 25 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) |