[Git][ghc/ghc][wip/romes/12935] Fix bug triggered by static data generated during SRT
Rodrigo Mesquita (@alt-romes)
gitlab at gitlab.haskell.org
Mon Jun 24 10:48:33 UTC 2024
Rodrigo Mesquita pushed to branch wip/romes/12935 at Glasgow Haskell Compiler / GHC
Commits:
a83a50f7 by Rodrigo Mesquita at 2024-06-24T11:48:23+01:00
Fix bug triggered by static data generated during SRT
- - - - -
2 changed files:
- compiler/GHC/Cmm/Info/Build.hs
- compiler/GHC/Cmm/UniqueRenamer.hs
Changes:
=====================================
compiler/GHC/Cmm/Info/Build.hs
=====================================
@@ -887,7 +887,7 @@ doSRTs
-> IO (ModuleSRTInfo, [CmmDeclSRTs])
doSRTs cfg moduleSRTInfo procs data_ = do
- us <- mkSplitUniqSupply 'u'
+ us <- mkSplitUniqSupply 'u' -- ROMES:TODO: We could use a deterministic supply here? All names from here on out should be deterministic. Perhaps I could also grep for all supplies created after this point in its closure or somethinkg...
let profile = cmmProfile cfg
=====================================
compiler/GHC/Cmm/UniqueRenamer.hs
=====================================
@@ -87,6 +87,14 @@ detRenameUniques dufm x = swap $ runState (uniqRename x) dufm
detRenameCLabel :: CLabel -> DetRnM CLabel
detRenameCLabel = mapInternalNonDetUniques renameDetUniq
+-- | We want to rename uniques in Ids, but ONLY internal ones.
+detRenameId :: Id -> DetRnM Id
+detRenameId i
+ | isInternalName (idName i)
+ = setIdUnique i <$> renameDetUniq (getUnique i)
+ | otherwise
+ = pure i
+
--------------------------------------------------------------------------------
-- Traversals
--------------------------------------------------------------------------------
@@ -149,7 +157,10 @@ instance UniqRenamable CmmStatics where
instance UniqRenamable CmmInfoTable where
uniqRename CmmInfoTable{cit_lbl, cit_rep, cit_prof, cit_srt, cit_clo}
- = CmmInfoTable <$> uniqRename cit_lbl <*> pure cit_rep <*> pure cit_prof <*> uniqRename cit_srt <*> pure cit_clo
+ = CmmInfoTable <$> uniqRename cit_lbl <*> pure cit_rep <*> pure cit_prof <*> uniqRename cit_srt <*>
+ (case cit_clo of
+ Nothing -> pure Nothing
+ Just (an_id, ccs) -> Just <$> detRenameId an_id <*> pure ccs)
instance UniqRenamable Section where
uniqRename (Section ty lbl) = Section ty <$> uniqRename lbl
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/a83a50f74d7948bbdd4ec0929904f32f5e7d4580
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/a83a50f74d7948bbdd4ec0929904f32f5e7d4580
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/20240624/aeb07367/attachment-0001.html>
More information about the ghc-commits
mailing list