[Git][ghc/ghc][master] interpreter: Always print uniques for BCO_NAME labels
Marge Bot (@marge-bot)
gitlab at gitlab.haskell.org
Tue Feb 18 14:01:51 UTC 2025
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
cd2be3be by Matthew Pickering at 2025-02-18T08:58:14-05:00
interpreter: Always print uniques for BCO_NAME labels
In the previous commit I omitted to include the unique, which still
makes it very difficult to trace back where the BCO came from.
- - - - -
2 changed files:
- compiler/GHC/StgToByteCode.hs
- compiler/GHC/Types/Name.hs
Changes:
=====================================
compiler/GHC/StgToByteCode.hs
=====================================
@@ -269,7 +269,7 @@ mkProtoBCO platform _add_bco_name nm instrs_ordlist origin arity bitmap_size bit
#if MIN_VERSION_rts(1,0,3)
maybe_add_bco_name instrs
| Just cur_mod <- _add_bco_name =
- let str = BS.pack $ showSDocOneLine defaultSDocContext (pprFullName cur_mod nm)
+ let str = BS.pack $ showSDocOneLine defaultSDocContext (pprFullNameWithUnique cur_mod nm)
in BCO_NAME str : instrs
#endif
maybe_add_bco_name instrs = instrs
=====================================
compiler/GHC/Types/Name.hs
=====================================
@@ -60,7 +60,7 @@ module GHC.Types.Name (
pprName,
nameSrcLoc, nameSrcSpan, pprNameDefnLoc, pprDefinedAt,
- pprFullName, pprTickyName,
+ pprFullName, pprFullNameWithUnique, pprTickyName,
-- ** Predicates on 'Name's
isSystemName, isInternalName, isExternalName,
@@ -732,6 +732,18 @@ pprFullName this_mod Name{n_sort = sort, n_occ = occ} =
<> colon <> ftext (moduleNameFS $ moduleName mod)
<> dot <> ftext (occNameFS occ)
+-- | Print fully qualified name (with unit-id and module, with the unique)
+pprFullNameWithUnique :: Module -> Name -> SDoc
+pprFullNameWithUnique this_mod Name{n_sort = sort, n_uniq = u, n_occ = occ} =
+ let mod = case sort of
+ WiredIn m _ _ -> m
+ External m -> m
+ System -> this_mod
+ Internal -> this_mod
+ in ftext (unitIdFS (moduleUnitId mod))
+ <> colon <> ftext (moduleNameFS $ moduleName mod)
+ <> dot <> ftext (occNameFS occ) <> text "_" <> pprUniqueAlways u
+
-- | Print a ticky ticky styled name
--
-- Module argument is the module to use for internal and system names. When
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/cd2be3bec6ac1df225a556ab2077189c39b21012
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/cd2be3bec6ac1df225a556ab2077189c39b21012
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/20250218/644bdb9e/attachment-0001.html>
More information about the ghc-commits
mailing list