summaryrefslogtreecommitdiff
path: root/compiler/profiling
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2008-09-30 14:18:12 +0000
committerSimon Marlow <marlowsd@gmail.com>2008-09-30 14:18:12 +0000
commite0ff87e4c56e8caf94b95e927ebd743ad3995a31 (patch)
treec4a9d9f44551ccbdd1e8f96d0da54ca267b63922 /compiler/profiling
parentdeb41aa9252c516c73b896dd52712c7dd912621e (diff)
downloadhaskell-e0ff87e4c56e8caf94b95e927ebd743ad3995a31.tar.gz
Fix #2410: carefully generate unique names for CAF CCs
Diffstat (limited to 'compiler/profiling')
-rw-r--r--compiler/profiling/CostCentre.lhs15
1 files changed, 9 insertions, 6 deletions
diff --git a/compiler/profiling/CostCentre.lhs b/compiler/profiling/CostCentre.lhs
index 4d13f102d2..dc93a1fcbb 100644
--- a/compiler/profiling/CostCentre.lhs
+++ b/compiler/profiling/CostCentre.lhs
@@ -39,6 +39,7 @@ module CostCentre (
import Var ( Id )
import Name
import Module ( Module )
+import Unique
import Outputable
import FastTypes
import FastString
@@ -226,12 +227,14 @@ mkAutoCC id mod is_caf
}
where
name = getName id
- -- beware: we might be making an auto CC for a compiler-generated
- -- thing (like a CAF when -caf-all is on), so include the uniq.
- -- See bug #249, tests prof001, prof002
- str | isSystemName name = mkFastString (showSDoc (ppr name))
- | otherwise = occNameFS (getOccName id)
-
+ -- beware: only external names are guaranteed to have unique
+ -- Occnames. If the name is not external, we must append its
+ -- Unique.
+ -- See bug #249, tests prof001, prof002, also #2411
+ str | isExternalName name = occNameFS (getOccName id)
+ | otherwise = mkFastString $ showSDoc $
+ ftext (occNameFS (getOccName id))
+ <> char '_' <> pprUnique (getUnique name)
mkAllCafsCC :: Module -> CostCentre
mkAllCafsCC m = AllCafsCC { cc_mod = m }