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 /compiler/HsVersions.h | |
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 'compiler/HsVersions.h')
-rw-r--r-- | compiler/HsVersions.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/compiler/HsVersions.h b/compiler/HsVersions.h index 83cbcf15cb..4a0b04ad70 100644 --- a/compiler/HsVersions.h +++ b/compiler/HsVersions.h @@ -32,6 +32,22 @@ name = Util.global (value); name :: IORef (ty); \ name = Util.globalM (value); + +#define SHARED_GLOBAL_VAR(name,accessor,saccessor,value,ty) \ +{-# NOINLINE name #-}; \ +name :: IORef (ty); \ +name = Util.sharedGlobal (value) (accessor); \ +foreign import ccall unsafe saccessor \ + accessor :: Ptr (IORef a) -> IO (Ptr (IORef a)); + +#define SHARED_GLOBAL_VAR_M(name,accessor,saccessor,value,ty) \ +{-# NOINLINE name #-}; \ +name :: IORef (ty); \ +name = Util.sharedGlobalM (value) (accessor); \ +foreign import ccall unsafe saccessor \ + accessor :: Ptr (IORef a) -> IO (Ptr (IORef a)); + + #define ASSERT(e) if debugIsOn && not (e) then (assertPanic __FILE__ __LINE__) else #define ASSERT2(e,msg) if debugIsOn && not (e) then (assertPprPanic __FILE__ __LINE__ (msg)) else #define WARN( e, msg ) (warnPprTrace (e) __FILE__ __LINE__ (msg)) $ |