[Git][ghc/ghc][master] 2 commits: InfoTableProv: ShortText --> ShortByteString
Marge Bot (@marge-bot)
gitlab at gitlab.haskell.org
Tue Jan 31 18:08:19 UTC 2023
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
19c1fbcd by doyougnu at 2023-01-31T13:08:03-05:00
InfoTableProv: ShortText --> ShortByteString
- - - - -
765fab98 by doyougnu at 2023-01-31T13:08:03-05:00
FastString: add fastStringToShorText
- - - - -
2 changed files:
- compiler/GHC/Data/FastString.hs
- compiler/GHC/StgToCmm/InfoTableProv.hs
Changes:
=====================================
compiler/GHC/Data/FastString.hs
=====================================
@@ -52,6 +52,9 @@ module GHC.Data.FastString
fastStringToShortByteString,
mkFastStringShortByteString,
+ -- * ShortText
+ fastStringToShortText,
+
-- * FastZString
FastZString,
hPutFZS,
@@ -130,6 +133,7 @@ import qualified Data.ByteString.Short as SBS
#if !MIN_VERSION_bytestring(0,11,0)
import qualified Data.ByteString.Short.Internal as SBS
#endif
+import GHC.Data.ShortText (ShortText(..))
import Foreign.C
import System.IO
import Data.Data
@@ -159,6 +163,9 @@ fastStringToByteString = bytesFS
fastStringToShortByteString :: FastString -> ShortByteString
fastStringToShortByteString = fs_sbs
+fastStringToShortText :: FastString -> ShortText
+fastStringToShortText = ShortText . fs_sbs
+
fastZStringToByteString :: FastZString -> ByteString
fastZStringToByteString (FastZString bs) = bs
=====================================
compiler/GHC/StgToCmm/InfoTableProv.hs
=====================================
@@ -5,7 +5,7 @@ import GHC.Platform
import GHC.Unit.Module
import GHC.Utils.Outputable
import GHC.Types.SrcLoc (pprUserRealSpan, srcSpanFile)
-import GHC.Data.FastString (unpackFS)
+import GHC.Data.FastString (fastStringToShortText)
import GHC.Cmm.CLabel
import GHC.Cmm.Expr
@@ -70,13 +70,13 @@ toCgIPE platform ctx module_name ipe = do
let label_str = maybe "" snd (infoTableProv ipe)
let (src_loc_file, src_loc_span) =
case infoTableProv ipe of
- Nothing -> ("", "")
+ Nothing -> (mempty, "")
Just (span, _) ->
- let file = unpackFS $ srcSpanFile span
+ let file = fastStringToShortText $ srcSpanFile span
coords = renderWithContext ctx (pprUserRealSpan False span)
in (file, coords)
- label <- lookupStringTable $ ST.pack label_str
- src_file <- lookupStringTable $ ST.pack src_loc_file
+ label <- lookupStringTable $ ST.pack label_str
+ src_file <- lookupStringTable $ src_loc_file
src_span <- lookupStringTable $ ST.pack src_loc_span
return $ CgInfoProvEnt { ipeInfoTablePtr = infoTablePtr ipe
, ipeTableName = table_name
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/7716cbe64862932fd69348b2594a14f2092e1c02...765fab98b0795bbe8ad50796c55b9408a2af54cf
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/7716cbe64862932fd69348b2594a14f2092e1c02...765fab98b0795bbe8ad50796c55b9408a2af54cf
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20230131/d4988f4c/attachment-0001.html>
More information about the ghc-commits
mailing list