summaryrefslogtreecommitdiff
path: root/compiler/utils
diff options
context:
space:
mode:
authorEdward Z. Yang <ezyang@cs.stanford.edu>2014-08-06 11:55:06 +0100
committerEdward Z. Yang <ezyang@cs.stanford.edu>2014-08-07 13:39:23 +0100
commit4855be0d0d1ac90f836a6fb54f4034f478e38fd8 (patch)
treef733368b2b043c8ac3d28d63a6cdeece7ebb6afd /compiler/utils
parent18ac546d8db93f170cdbc29da8b7118272b065e7 (diff)
downloadhaskell-4855be0d0d1ac90f836a6fb54f4034f478e38fd8.tar.gz
Give the Unique generated by strings a tag '$', fixes #9413.
Summary: Previously, we allocated uniques for strings starting at zero, which means the tag bits in the unique are zero, which means that printing a Unique for a string will start with a null byte. This is bad. So instead, start our numbering with the tag byte as '$' (as in $tring). This is hard coded so we don't have to worry about the optimizer reducing the expression. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: hvr, simonmar, austin Subscribers: simonmar, relrod, ezyang, carter Differential Revision: https://phabricator.haskell.org/D123 GHC Trac Issues: #9413
Diffstat (limited to 'compiler/utils')
-rw-r--r--compiler/utils/FastString.lhs2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/utils/FastString.lhs b/compiler/utils/FastString.lhs
index 0396c02749..157e5f08b0 100644
--- a/compiler/utils/FastString.lhs
+++ b/compiler/utils/FastString.lhs
@@ -239,7 +239,7 @@ data FastStringTable =
string_table :: FastStringTable
{-# NOINLINE string_table #-}
string_table = unsafePerformIO $ do
- uid <- newIORef 0
+ uid <- newIORef 603979776 -- ord '$' * 0x01000000
tab <- IO $ \s1# -> case newArray# hASH_TBL_SIZE_UNBOXED (panic "string_table") s1# of
(# s2#, arr# #) ->
(# s2#, FastStringTable uid arr# #)