X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2FbasicTypes%2FUnique.lhs;h=5f9f66834f3a5ff311b397f15face7018331ea43;hb=b6d08641e2757898470a10dfa906084ade8ab835;hp=874328863e7b745c79e52abb3e25709ec7fc200d;hpb=0065d5ab628975892cea1ec7303f968c3338cbe1;p=ghc-hetmet.git diff --git a/compiler/basicTypes/Unique.lhs b/compiler/basicTypes/Unique.lhs index 8743288..5f9f668 100644 --- a/compiler/basicTypes/Unique.lhs +++ b/compiler/basicTypes/Unique.lhs @@ -1,4 +1,5 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % @@ -15,6 +16,13 @@ Some of the other hair in this code is to be able to use a Haskell). \begin{code} +{-# OPTIONS -w #-} +-- The above warning supression flag is a temporary kludge. +-- While working on this module you are encouraged to remove it and fix +-- any warnings in the module. See +-- http://hackage.haskell.org/trac/ghc/wiki/Commentary/CodingStyle#Warnings +-- for details + module Unique ( Unique, Uniquable(..), hasKey, @@ -49,15 +57,13 @@ module Unique ( #include "HsVersions.h" -import BasicTypes ( Boxity(..) ) -import PackageConfig ( PackageId, packageIdFS ) -import FastString ( FastString, uniqueOfFS ) +import StaticFlags +import BasicTypes +import FastString import Outputable -import FastTypes - -import GLAEXTS -import Char ( chr, ord ) +import GHC.Exts +import Data.Char ( chr, ord ) \end{code} %************************************************************************ @@ -120,25 +126,15 @@ i2w_s x = (x::Int#) mkUnique (C# c) (I# i) = MkUnique (w2i (tag `or#` bits)) where -#if __GLASGOW_HASKELL__ >= 503 tag = i2w (ord# c) `uncheckedShiftL#` i2w_s 24# -#else - tag = i2w (ord# c) `shiftL#` i2w_s 24# -#endif bits = i2w i `and#` (i2w 16777215#){-``0x00ffffff''-} unpkUnique (MkUnique u) = let - tag = C# (chr# (w2i ((i2w u) `shiftr` (i2w_s 24#)))) + tag = C# (chr# (w2i ((i2w u) `uncheckedShiftRL#` (i2w_s 24#)))) i = I# (w2i ((i2w u) `and#` (i2w 16777215#){-``0x00ffffff''-})) in (tag, i) - where -#if __GLASGOW_HASKELL__ >= 503 - shiftr x y = uncheckedShiftRL# x y -#else - shiftr x y = shiftRL# x y -#endif \end{code} @@ -159,9 +155,6 @@ x `hasKey` k = getUnique x == k instance Uniquable FastString where getUnique fs = mkUniqueGrimily (I# (uniqueOfFS fs)) -instance Uniquable PackageId where - getUnique pid = getUnique (packageIdFS pid) - instance Uniquable Int where getUnique i = mkUniqueGrimily i \end{code} @@ -205,6 +198,11 @@ We do sometimes make strings with @Uniques@ in them: \begin{code} pprUnique :: Unique -> SDoc pprUnique uniq +#ifdef DEBUG + | opt_SuppressUniques + = empty -- Used exclusively to suppress uniques so you + | otherwise -- can compare output easily +#endif = case unpkUnique uniq of (tag, u) -> finish_ppr tag u (text (iToBase62 u))