[commit: ghc] master: Move the genSym stuff from rts into compiler (a08759d)
Ian Lynagh
igloo at earth.li
Sat May 18 13:46:41 CEST 2013
Repository : http://darcs.haskell.org/ghc.git/
On branch : master
https://github.com/ghc/ghc/commit/a08759d165ca1a0cfe9ada26f6ea6b9a38ad8853
>---------------------------------------------------------------
commit a08759d165ca1a0cfe9ada26f6ea6b9a38ad8853
Author: Ian Lynagh <ian at well-typed.com>
Date: Fri May 17 16:50:08 2013 +0100
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.
>---------------------------------------------------------------
compiler/basicTypes/UniqSupply.lhs | 4 ++--
compiler/cbits/genSym.c | 9 +++++++++
compiler/ghc.cabal.in | 1 +
includes/rts/Utils.h | 5 -----
rts/Linker.c | 1 -
rts/RtsUtils.c | 20 --------------------
6 files changed, 12 insertions(+), 28 deletions(-)
diff --git a/compiler/basicTypes/UniqSupply.lhs b/compiler/basicTypes/UniqSupply.lhs
index f3fb28a..fb07e73 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 0000000..2d9779b
--- /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 7ce0a52..90a241f 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 1cb52ae..119ec5b 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 2bcc522..06cd6d2 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 fcbb757..cb9002c 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.
-------------------------------------------------------------------------- */
More information about the ghc-commits
mailing list