[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:50:37 UTC 2024
Rodrigo Mesquita pushed to branch wip/romes/12935 at Glasgow Haskell Compiler / GHC
Commits:
6e36132e by Rodrigo Mesquita at 2024-06-24T11:50:07+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
=====================================
@@ -22,6 +22,7 @@ import GHC.Utils.Outputable as Outputable
import Data.Tuple (swap)
import qualified Data.Map as M
import qualified Data.Set as S
+import GHC.Types.Id
{-
--------------------------------------------------------------------------------
@@ -87,6 +88,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 +158,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/6e36132ea8064bc8d5440600d86850f916d62dcf
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/6e36132ea8064bc8d5440600d86850f916d62dcf
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/d4cc694d/attachment-0001.html>
More information about the ghc-commits
mailing list