diff options
author | Moritz Angermann <moritz.angermann@gmail.com> | 2016-11-29 16:50:32 -0500 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2016-11-29 16:50:33 -0500 |
commit | 6f7ed1e51bf360621a3c2a447045ab3012f68575 (patch) | |
tree | f6e047df820dce2a049ead7927c1b36e95b2bfdd /compiler/HsVersions.h | |
parent | 795f8bd460d604c792a5df8cfec937b2a74c3956 (diff) | |
download | haskell-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 '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)) $ |