[get rid of references to old Atom, change the representation of various things to be more efficient. get rid of some uses of PackedString when Atom makes more sense.
John Meacham <john@repetae.net>**20080210135451] hunk ./Atom.hs 1
-module Atom(
-    Atom(),
-    Atom.toString,
-    FromAtom(..),
-    ToAtom(..),
-    dumpAtomTable,
-    fromPackedStringIO,
-    fromString,
-    fromStringIO,
-    toPackedString,
-    atomIndex,
-    unsafeAtomToInt,
-    unsafeIntToAtom,
-    intToAtom
-    ) where
-
-import Char
-import Foreign
-import Control.Monad
-import Data.Binary
-import Data.Binary.Get
-import Data.Binary.Put
-import PackedString(PackedString(..))
-import qualified Data.ByteString as BS
-import StringTable.Atom
-
-
-toString :: Atom -> String
-toString = fromAtom
-
-fromString :: String -> Atom
-fromString string = toAtom string
-
-
-atomIndex,unsafeAtomToInt :: Atom -> Int
-atomIndex = fromAtom
-unsafeAtomToInt = fromAtom
-
-instance FromAtom (String -> String) where
-    fromAtom x = shows (fromAtom x :: String)
-
-instance ToAtom PackedString where
-    toAtomIO (PS x) = toAtomIO x
-instance FromAtom PackedString where
-    fromAtomIO atom = PS `liftM` fromAtomIO atom
-
-
-fromStringIO :: String -> IO Atom
-fromStringIO cs = toAtomIO cs
-
-fromPackedStringIO :: PackedString -> IO Atom
-fromPackedStringIO ps = toAtomIO ps
-
-
-dumpAtomTable = do
-    dumpTable
-    dumpStringTableStats
-
-
-toPackedString :: Atom -> PackedString
-toPackedString = fromAtom
-
-instance Binary Atom where
-    get = do
-        x <- getWord8
-        bs <- getBytes (fromIntegral x)
-        return $ toAtom bs
-    put a = do
-        let bs = fromAtom a
-        putWord8 $ fromIntegral $ BS.length bs
-        putByteString bs
-
rmfile ./Atom.hs
hunk ./C/FromGrin2.hs 17
-import Atom
+import StringTable.Atom
hunk ./C/FromGrin2.hs 461
-        Nothing -> return $ (mempty, functionCall (toName (toString a)) vs')
+        Nothing -> return $ (mempty, functionCall (toName (fromAtom a)) vs')
hunk ./C/FromGrin2.hs 739
-nodeTagName a = toName (toString a)
+nodeTagName a = toName (fromAtom a)
hunk ./C/FromGrin2.hs 741
-nodeFuncName a = toName (toString a)
+nodeFuncName a = toName (fromAtom a)
hunk ./C/FromGrin2.hs 767
-nodeStructName a = toName ('s':toString a)
+nodeStructName a = toName ('s':fromAtom a)
hunk ./C/Prims.hs 7
+import StringTable.Atom
hunk ./C/Prims.hs 33
-    PrimPrim PackedString          -- Special primitive implemented in the compiler somehow.
+    PrimPrim Atom          -- Special primitive implemented in the compiler somehow.
hunk ./C/Prims.hs 131
-primPrim s = APrim (PrimPrim $ packString s) mempty
+primPrim s = APrim (PrimPrim $ toAtom s) mempty
hunk ./C/Prims.hs 145
-    pprint (PrimPrim t) = text (unpackPS t)
+    pprint (PrimPrim t) = text (fromAtom t)
hunk ./E/Binary.hs 3
-import Atom
+import StringTable.Atom
hunk ./E/Binary.hs 33
-            TvrBinaryAtom a -> return $ TVr (atomIndex a) e nf
+            TvrBinaryAtom a -> return $ TVr (fromAtom a) e nf
hunk ./E/Demand.hs 22
-import PackedString
-import C.Prims
hunk ./E/Demand.hs 295
+
hunk ./E/Demand.hs 302
-    return (EPrim (APrim (PrimPrim $ packString "dependingOn") mempty) [t1',t2'] pt,dt1 `glb` dt2)
+    return (EPrim p_dependingOn [t1',t2'] pt,dt1 `glb` dt2)
hunk ./E/Demand.hs 353
-from_dependingOn (EPrim (APrim (PrimPrim don) _) [t1,t2] pt) | don == packString "dependingOn" = return (t1,t2,pt)
+from_dependingOn (EPrim don [t1,t2] pt) | don == p_dependingOn = return (t1,t2,pt)
hunk ./E/E.hs 132
+p_dependingOn = primPrim "dependingOn"
hunk ./E/FromHs.hs 23
+import StringTable.Atom
hunk ./E/FromHs.hs 434
-            prim      = APrim (PrimPrim $ packString cn) req
+            prim      = APrim (PrimPrim $ toAtom cn) req
hunk ./E/Inline.hs 15
-import Atom
+import StringTable.Atom
hunk ./E/PrimOpt.hs 11
-import Atom
-import PackedString
+import StringTable.Atom
hunk ./E/PrimOpt.hs 156
-processPrimPrim dataTable o@(EPrim (APrim (PrimPrim s) _) es orig_t) = maybe o id (primopt (unpackPS s) es (followAliases dataTable orig_t)) where
+processPrimPrim dataTable o@(EPrim (APrim (PrimPrim s) _) es orig_t) = maybe o id (primopt (fromAtom s) es (followAliases dataTable orig_t)) where
hunk ./E/Rules.hs 27
-import Atom(toAtom)
+import StringTable.Atom(toAtom)
hunk ./E/Type.hs 10
-import Atom
+import StringTable.Atom
hunk ./E/Values.hs 9
-import PackedString
hunk ./E/Values.hs 169
-from_unsafeCoerce (EPrim (APrim (PrimPrim unsafeCoerce) _) [e] t) | unsafeCoerce == packString "unsafeCoerce" = return (e,t)
+from_unsafeCoerce (EPrim pp [e] t) | pp == p_unsafeCoerce = return (e,t)
hunk ./E/Values.hs 176
-unsafeCoerceOpt (EPrim (APrim (PrimPrim uc) _) [e] t) | uc == packString "unsafeCoerce" = f (0::Int) e t where
+unsafeCoerceOpt (EPrim uc [e] t) | uc == p_unsafeCoerce = f (0::Int) e t where
hunk ./E/Values.hs 218
-isAtomic (EPrim (APrim (PrimPrim don) _) [x,y] _) | don == packString "dependingOn" = isAtomic x
+isAtomic (EPrim don [x,y] _) | don == p_dependingOn = isAtomic x
hunk ./FrontEnd/HsSyn.hs 5
-import Atom
+import StringTable.Atom
+import StringTable.Atom()
hunk ./FrontEnd/HsSyn.hs 10
-import PackedString
hunk ./FrontEnd/HsSyn.hs 46
-    toAtom = Atom.fromString . show
+    toAtom = toAtom . show
hunk ./FrontEnd/HsSyn.hs 59
-        return (Module $ unpackPS ps)
-    put (Module n) = put (packString n)
+        return (Module $ fromAtom ps)
+    put (Module n) = put (toAtom n)
hunk ./FrontEnd/HsSyn.hs 65
-        return (HsIdent $ unpackPS ps)
-    put (HsIdent n) = put (packString n)
+        return (HsIdent $ fromAtom ps)
+    put (HsIdent n) = put (toAtom n)
hunk ./FrontEnd/Representation.hs 41
-import Atom
+import StringTable.Atom
hunk ./FrontEnd/Representation.hs 126
-tyvar n k = Tyvar (fromString $ show n) n k
+tyvar n k = Tyvar (toAtom $ show n) n k
hunk ./FrontEnd/Tc/Monad.hs 65
-import Atom
+import StringTable.Atom
hunk ./Grin/DeadCode.hs 9
-import Atom
+import StringTable.Atom
hunk ./Grin/Embed.hs 6
-import Atom
+import StringTable.Atom
hunk ./Grin/EvalInline.hs 10
-import Atom
+import StringTable.Atom
hunk ./Grin/EvalInline.hs 106
-    ts = sortUnder toPackedString ts'
+    ts = sortBy atomCompare ts'
hunk ./Grin/FromE.hs 14
-import Atom
+import StringTable.Atom
hunk ./Grin/FromE.hs 38
-import PackedString
hunk ./Grin/FromE.hs 118
-cafNum n = V $ - atomIndex (partialTag (scTag n) 0)
+cafNum n = V $ - fromAtom (partialTag (scTag n) 0)
hunk ./Grin/FromE.hs 402
-    ce (EPrim ap@(APrim (PrimPrim prim) _) as _) = f (unpackPS prim) as where
+    ce (EPrim ap@(APrim (PrimPrim prim) _) as _) = f (fromAtom prim) as where
hunk ./Grin/FromE.hs 575
-    cc (EPrim (APrim (PrimPrim don) _) [e,_] _) | don == packString "dependingOn" = cc e
+    cc (EPrim don [e,_] _) | don == p_dependingOn  = cc e
hunk ./Grin/FromE.hs 684
-    --                        False -> return $ Var (V $ - atomIndex t) (TyPtr TyNode)
+    --                        False -> return $ Var (V $ - fromAtom t) (TyPtr TyNode)
hunk ./Grin/Grin.hs 63
-import Atom
+import StringTable.Atom
hunk ./Grin/HashConst.hs 6
-import Atom
+import StringTable.Atom
hunk ./Grin/Interpret.hs 3
-import Atom
+import StringTable.Atom
hunk ./Grin/NodeAnalyze.hs 18
-import Atom
+import StringTable.Atom
hunk ./Grin/Noodle.hs 10
-import Atom(Atom())
+import StringTable.Atom(Atom())
hunk ./Grin/Optimize.hs 8
-import Atom
+import StringTable.Atom
hunk ./Grin/SSimplify.hs 8
-import Atom
+import StringTable.Atom
hunk ./Grin/Show.hs 19
-import Atom
+import StringTable.Atom
hunk ./Grin/Simplify.hs 15
-import Atom
+import StringTable.Atom
hunk ./Grin/Simplify.hs 190
-fromBap t | 'B':'a':'p':'_':(n:ns) <- toString t, isDigit n = return $ read (n:takeWhile isDigit ns)
+fromBap t | 'B':'a':'p':'_':(n:ns) <- fromAtom t, isDigit n = return $ read (n:takeWhile isDigit ns)
hunk ./Grin/Unboxing.hs 8
-import Atom
+import StringTable.Atom
hunk ./Grin/Val.hs 11
-import Atom
+import StringTable.Atom
hunk ./Ho/Build.hs 27
+import StringTable.Atom
+import PackedString(packString)
hunk ./Ho/Build.hs 54
-import PackedString
hunk ./Ho/Build.hs 84
-version :: Int
-version = 7
-
-magic = (packString "jhc Haskell Object File",version)
-
hunk ./Ho/Build.hs 439
-        let pdesc = [(packString n, packString v) | (n,v) <- ("jhc-hl-filename",outName):("jhc-description-file",fp):("jhc-compiled-by",versionString):desc, n /= "exposed-modules" ]
+        let pdesc = [(toAtom n, packString v) | (n,v) <- ("jhc-hl-filename",outName):("jhc-description-file",fp):("jhc-compiled-by",versionString):desc, n /= "exposed-modules" ]
hunk ./Ho/Build.hs 480
-    putStrLn $ "MetaInfo:\n" <> vcat (sort [text (' ':' ':unpackPS k) <> char ':' <+> show v | (k,v) <- hohMetaInfo hoh])
+    putStrLn $ "MetaInfo:\n" <> vcat (sort [text (' ':' ':fromAtom k) <> char ':' <+> show v | (k,v) <- hohMetaInfo hoh])
hunk ./Ho/Type.hs 6
+import StringTable.Atom
hunk ./Ho/Type.hs 57
-    hohMetaInfo   :: [(PackedString,PackedString)]
+    hohMetaInfo   :: [(Atom,PackedString)]
hunk ./Makefile.am 14
-HSFILES= Atom.hs C/Arch.hs C/FFI.hs C/FromGrin2.hs C/Generate.hs CharIO.hs C/OpEval.hs C/Op.hs \
+HSFILES= C/Arch.hs C/FFI.hs C/FromGrin2.hs C/Generate.hs CharIO.hs C/OpEval.hs C/Op.hs \
hunk ./Name/Id.hs 36
-import Atom
+import StringTable.Atom
hunk ./Stats.hs 47
-import Atom
+import StringTable.Atom
hunk ./Stats.hs 106
-prependStat name (Stat m) = Stat $ IB.fromList [ (unsafeAtomToInt (toAtom $ "{" ++ name ++ "}." ++ fromAtom (unsafeIntToAtom x)),y) | (x,y) <- IB.toList m ]
+prependStat name (Stat m) = Stat $ IB.fromList [ (fromAtom (toAtom $ "{" ++ name ++ "}." ++ fromAtom (unsafeIntToAtom x)),y) | (x,y) <- IB.toList m ]
hunk ./Stats.hs 184
-    mticks' n k = StatT $ tell (Stat $ IB.msingleton (unsafeAtomToInt k) n)
+    mticks' n k = StatT $ tell (Stat $ IB.msingleton (fromAtom k) n)
hunk ./Stats.hs 187
-singleton n = Stat $ IB.singleton (unsafeAtomToInt $ toAtom n)
+singleton n = Stat $ IB.singleton (fromAtom $ toAtom n)
hunk ./Stats.hs 191
-singleStat n k = Stat $ IB.msingleton (unsafeAtomToInt $ toAtom k) n
+singleStat n k = Stat $ IB.msingleton (fromAtom $ toAtom k) n
hunk ./StringTable/Atom.hsc 21
+import Control.Monad
+import Data.Binary
+import Data.Binary.Get
+import Data.Binary.Put
hunk ./StringTable/Atom.hsc 33
+import PackedString(PackedString(..))
hunk ./StringTable/Atom.hsc 68
+instance FromAtom (String -> String) where
+    fromAtom x = shows (fromAtom x :: String)
+
+instance ToAtom PackedString where
+    toAtomIO (PS x) = toAtomIO x
+instance FromAtom PackedString where
+    fromAtomIO atom = PS `liftM` fromAtomIO atom
+
hunk ./StringTable/Atom.hsc 190
+instance Binary Atom where
+    get = do
+        x <- getWord8
+        bs <- getBytes (fromIntegral x)
+        return $ toAtom bs
+    put a = do
+        let bs = fromAtom a
+        putWord8 $ fromIntegral $ BS.length bs
+        putByteString bs
+
hunk ./selftest/SelfTest.hs 10
-import Atom
+import StringTable.Atom
hunk ./selftest/SelfTest.hs 59
-prop_atomIndex (xs :: String) = intToAtom (atomIndex a) == Just a where
+prop_atomIndex (xs :: String) = intToAtom (fromAtom a) == Just a where
hunk ./selftest/SelfTest.hs 61
-prop_atomneq' xs ys = (xs `compare` ys) == (toPackedString a1 `compare` toPackedString a2) where
+prop_atomneq' xs ys = (xs `compare` ys) == (fromAtom a1 `compare` (fromAtom a2 :: PackedString)) where