summaryrefslogtreecommitdiff
path: root/compiler/cbits
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2021-06-04 15:09:37 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-06-05 03:48:25 -0400
commit9a28680d2e23e7b25dd7254a439aea31dfae32d5 (patch)
treed6b41a447d8bfb5c907f5e278c7e5f1127c6c450 /compiler/cbits
parent1713cbb038116c2d703238b47f78c4861232db8e (diff)
downloadhaskell-9a28680d2e23e7b25dd7254a439aea31dfae32d5.tar.gz
Put Unique related global variables in the RTS (#19940)
Diffstat (limited to 'compiler/cbits')
-rw-r--r--compiler/cbits/genSym.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/compiler/cbits/genSym.c b/compiler/cbits/genSym.c
index 8a47d77f27..eed2b4f142 100644
--- a/compiler/cbits/genSym.c
+++ b/compiler/cbits/genSym.c
@@ -1,9 +1,15 @@
#include <Rts.h>
#include <assert.h>
#include "Unique.h"
+#include "ghcversion.h"
+// These global variables have been moved into the RTS. It allows them to be
+// shared with plugins even if two different instances of the GHC library are
+// loaded at the same time (#19940)
+#if !MIN_VERSION_GLASGOW_HASKELL(9,3,0,0)
HsInt ghc_unique_counter = 0;
HsInt ghc_unique_inc = 1;
+#endif
#define UNIQUE_BITS (sizeof (HsInt) * 8 - UNIQUE_TAG_BITS)
#define UNIQUE_MASK ((1ULL << UNIQUE_BITS) - 1)