[Git][ghc/ghc][wip/T22010] Rename unique counter to avoid clash with old rts
Jaro Reinders (@Noughtmare)
gitlab at gitlab.haskell.org
Thu Jun 15 13:16:33 UTC 2023
Jaro Reinders pushed to branch wip/T22010 at Glasgow Haskell Compiler / GHC
Commits:
51c4ee9e by Jaro Reinders at 2023-06-15T15:16:27+02:00
Rename unique counter to avoid clash with old rts
- - - - -
6 changed files:
- compiler/GHC/Types/Unique/Supply.hs
- compiler/cbits/genSym.c
- rts/Globals.c
- rts/RtsSymbols.c
- rts/include/rts/Globals.h
- rts/js/globals.js
Changes:
=====================================
compiler/GHC/Types/Unique/Supply.hs
=====================================
@@ -235,7 +235,7 @@ foreign import ccall unsafe "genSym" genSym :: IO Word64
genSym :: IO Word64
genSym = do
let !mask = (1 `unsafeShiftL` uNIQUE_BITS) - 1
- let !(Ptr counter) = ghc_unique_counter
+ let !(Ptr counter) = ghc_unique_counter64
let !(Ptr inc_ptr) = ghc_unique_inc
u <- IO $ \s0 -> case readWordOffAddr# inc_ptr 0# s0 of
(# s1, inc #) -> case fetchAddWordAddr# counter inc s1 of
@@ -254,13 +254,13 @@ genSym = do
return u
#endif
-foreign import ccall unsafe "&ghc_unique_counter" ghc_unique_counter :: Ptr Word64
-foreign import ccall unsafe "&ghc_unique_inc" ghc_unique_inc :: Ptr Int
+foreign import ccall unsafe "&ghc_unique_counter64" ghc_unique_counter64 :: Ptr Word64
+foreign import ccall unsafe "&ghc_unique_inc" ghc_unique_inc :: Ptr Int
initUniqSupply :: Word64 -> Int -> IO ()
initUniqSupply counter inc = do
- poke ghc_unique_counter counter
- poke ghc_unique_inc inc
+ poke ghc_unique_counter64 counter
+ poke ghc_unique_inc inc
uniqFromMask :: Char -> IO Unique
uniqFromMask !mask
=====================================
compiler/cbits/genSym.c
=====================================
@@ -10,7 +10,7 @@
// The CPP is thus about the RTS version GHC is linked against, and not the
// version of the GHC being built.
#if !MIN_VERSION_GLASGOW_HASKELL(9,7,0,0)
-HsWord64 ghc_unique_counter = 0;
+HsWord64 ghc_unique_counter64 = 0;
#endif
#if !MIN_VERSION_GLASGOW_HASKELL(9,3,0,0)
HsInt ghc_unique_inc = 1;
@@ -34,7 +34,7 @@ atomic_inc64(StgWord64 volatile* p, StgWord64 incr)
#define UNIQUE_MASK ((1ULL << UNIQUE_BITS) - 1)
HsWord64 genSym(void) {
- HsWord64 u = atomic_inc64((StgWord64 *)&ghc_unique_counter, ghc_unique_inc) & UNIQUE_MASK;
+ HsWord64 u = atomic_inc64((StgWord64 *)&ghc_unique_counter64, ghc_unique_inc) & UNIQUE_MASK;
// Uh oh! We will overflow next time a unique is requested.
ASSERT(u != UNIQUE_MASK);
return u;
=====================================
rts/Globals.c
=====================================
@@ -108,5 +108,5 @@ mkStoreAccessor(LibHSghcGlobalHasPprDebug)
mkStoreAccessor(LibHSghcGlobalHasNoDebugOutput)
mkStoreAccessor(LibHSghcGlobalHasNoStateHack)
-HsWord64 ghc_unique_counter = 0;
+HsWord64 ghc_unique_counter64 = 0;
HsInt ghc_unique_inc = 1;
=====================================
rts/RtsSymbols.c
=====================================
@@ -551,7 +551,7 @@ extern char **environ;
SymI_HasProto(getOrSetLibHSghcGlobalHasPprDebug) \
SymI_HasProto(getOrSetLibHSghcGlobalHasNoDebugOutput) \
SymI_HasProto(getOrSetLibHSghcGlobalHasNoStateHack) \
- SymI_HasProto(ghc_unique_counter) \
+ SymI_HasProto(ghc_unique_counter64) \
SymI_HasProto(ghc_unique_inc) \
SymI_HasProto(genericRaise) \
SymI_HasProto(getProgArgv) \
=====================================
rts/include/rts/Globals.h
=====================================
@@ -32,5 +32,5 @@ mkStoreAccessorPrototype(LibHSghcFastStringTable)
mkStoreAccessorPrototype(LibHSghcGlobalHasPprDebug)
mkStoreAccessorPrototype(LibHSghcGlobalHasNoDebugOutput)
mkStoreAccessorPrototype(LibHSghcGlobalHasNoStateHack)
-extern HsWord64 ghc_unique_counter;
+extern HsWord64 ghc_unique_counter64;
extern HsInt ghc_unique_inc;
=====================================
rts/js/globals.js
=====================================
@@ -20,6 +20,6 @@ GVAR(h$getOrSetLibHSghcFastStringTable, faststring_table)
var h$ghc_unique_inc = h$newByteArray(4);
h$ghc_unique_inc.i3[0] = 1;
-var h$ghc_unique_counter = h$newByteArray(8);
-h$ghc_unique_counter.i3[0] = 0;
-h$ghc_unique_counter.i3[1] = 0;
+var h$ghc_unique_counter64 = h$newByteArray(8);
+h$ghc_unique_counter64.i3[0] = 0;
+h$ghc_unique_counter64.i3[1] = 0;
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/51c4ee9e13db3107b93c40a90fbbae3405cf5a3d
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/51c4ee9e13db3107b93c40a90fbbae3405cf5a3d
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20230615/67fbcf1e/attachment-0001.html>
More information about the ghc-commits
mailing list