diff options
author | Ian Lynagh <ian@well-typed.com> | 2013-05-17 16:50:08 +0100 |
---|---|---|
committer | Ian Lynagh <ian@well-typed.com> | 2013-05-17 16:50:08 +0100 |
commit | a08759d165ca1a0cfe9ada26f6ea6b9a38ad8853 (patch) | |
tree | 2043ea39590b0780e4e9443be680108b3bc325f5 | |
parent | 8ed0bdab7e69bfec14b1de2d662349626f587119 (diff) | |
download | haskell-a08759d165ca1a0cfe9ada26f6ea6b9a38ad8853.tar.gz |
Move the genSym stuff from rts into compiler
It's no longer used by Data.Unique, so there's no need to have it
in rts any more.
-rw-r--r-- | compiler/basicTypes/UniqSupply.lhs | 4 | ||||
-rw-r--r-- | compiler/cbits/genSym.c | 9 | ||||
-rw-r--r-- | compiler/ghc.cabal.in | 1 | ||||
-rw-r--r-- | includes/rts/Utils.h | 5 | ||||
-rw-r--r-- | rts/Linker.c | 1 | ||||
-rw-r--r-- | rts/RtsUtils.c | 20 |
6 files changed, 12 insertions, 28 deletions
diff --git a/compiler/basicTypes/UniqSupply.lhs b/compiler/basicTypes/UniqSupply.lhs index f3fb28ac21..fb07e73824 100644 --- a/compiler/basicTypes/UniqSupply.lhs +++ b/compiler/basicTypes/UniqSupply.lhs @@ -81,7 +81,7 @@ mkSplitUniqSupply c -- This is one of the most hammered bits in the whole compiler mk_supply = unsafeDupableInterleaveIO ( - genSymZh >>= \ u_ -> case iUnbox u_ of { u -> ( + genSym >>= \ u_ -> case iUnbox u_ of { u -> ( mk_supply >>= \ s1 -> mk_supply >>= \ s2 -> return (MkSplitUniqSupply (mask `bitOrFastInt` u) s1 s2) @@ -89,7 +89,7 @@ mkSplitUniqSupply c in mk_supply -foreign import ccall unsafe "genSymZh" genSymZh :: IO Int +foreign import ccall unsafe "genSym" genSym :: IO Int splitUniqSupply (MkSplitUniqSupply _ s1 s2) = (s1, s2) listSplitUniqSupply (MkSplitUniqSupply _ s1 s2) = s1 : listSplitUniqSupply s2 diff --git a/compiler/cbits/genSym.c b/compiler/cbits/genSym.c new file mode 100644 index 0000000000..2d9779b898 --- /dev/null +++ b/compiler/cbits/genSym.c @@ -0,0 +1,9 @@ + +#include "Rts.h" + +static HsInt GenSymCounter = 0; + +HsInt genSym(void) { + return GenSymCounter++; +} + diff --git a/compiler/ghc.cabal.in b/compiler/ghc.cabal.in index 7ce0a52fa1..90a241f8d4 100644 --- a/compiler/ghc.cabal.in +++ b/compiler/ghc.cabal.in @@ -99,6 +99,7 @@ Library c-sources: ghci/keepCAFsForGHCi.c + cbits/genSym.c hs-source-dirs: basicTypes diff --git a/includes/rts/Utils.h b/includes/rts/Utils.h index 1cb52ae83f..119ec5b6a0 100644 --- a/includes/rts/Utils.h +++ b/includes/rts/Utils.h @@ -13,11 +13,6 @@ #ifndef RTS_UTILS_H #define RTS_UTILS_H -// Used in GHC (basicTypes/Unique.lhs, and Data.Unique in the base -// package. -HsInt genSymZh(void); -HsInt resetGenSymZh(void); - /* Alternate to raise(3) for threaded rts, for BSD-based OSes */ int genericRaise(int sig); diff --git a/rts/Linker.c b/rts/Linker.c index 2bcc522218..06cd6d2025 100644 --- a/rts/Linker.c +++ b/rts/Linker.c @@ -1108,7 +1108,6 @@ typedef struct _RtsSymbolVal { SymI_HasProto(getOrSetSystemTimerThreadIOManagerThreadStore) \ SymI_HasProto(getGCStats) \ SymI_HasProto(getGCStatsEnabled) \ - SymI_HasProto(genSymZh) \ SymI_HasProto(genericRaise) \ SymI_HasProto(getProgArgv) \ SymI_HasProto(getFullProgArgv) \ diff --git a/rts/RtsUtils.c b/rts/RtsUtils.c index fcbb757c05..cb9002c361 100644 --- a/rts/RtsUtils.c +++ b/rts/RtsUtils.c @@ -137,26 +137,6 @@ heapOverflow(void) } /* ----------------------------------------------------------------------------- - genSym stuff, used by GHC itself for its splitting unique supply. - - ToDo: put this somewhere sensible. - ------------------------------------------------------------------------- */ - -static HsInt __GenSymCounter = 0; - -HsInt -genSymZh(void) -{ - return(__GenSymCounter++); -} -HsInt -resetGenSymZh(void) /* it's your funeral */ -{ - __GenSymCounter=0; - return(__GenSymCounter); -} - -/* ----------------------------------------------------------------------------- Get the current time as a string. Used in profiling reports. -------------------------------------------------------------------------- */ |