GlobalIdDetails(..), notGlobalId, -- Not abstract
IdInfo, -- Abstract
- vanillaIdInfo, noCafIdInfo,
+ vanillaIdInfo, noCafIdInfo, hasCafIdInfo,
seqIdInfo, megaSeqIdInfo,
-- Zapping
newStrictnessInfo = Nothing
}
-noCafIdInfo = vanillaIdInfo `setCgInfo` CgInfo NoCafRefs
+hasCafIdInfo = vanillaIdInfo `setCgInfo` CgInfo MayHaveCafRefs
+noCafIdInfo = vanillaIdInfo `setCgInfo` CgInfo NoCafRefs
-- Used for built-in type Ids in MkId.
- -- Many built-in things have fixed types, so we shouldn't
- -- run around generalising them
+ -- These must have a valid CgInfo set, so you can't
+ -- use vanillaIdInfo!
\end{code}
mkTemplateLocals, mkTemplateLocalsNum,
mkTemplateLocal, idNewStrictness, idName
)
-import IdInfo ( IdInfo, noCafIdInfo,
+import IdInfo ( IdInfo, noCafIdInfo, hasCafIdInfo,
setUnfoldingInfo,
setArityInfo, setSpecInfo, setCafInfo,
setAllStrictnessInfo,
default_alt | no_default = []
| otherwise = [(DEFAULT, [], error_expr)]
- -- the default branch may have CAF refs, because it calls recSelError etc.
+ -- The default branch may have CAF refs, because it calls recSelError etc.
caf_info | no_default = NoCafRefs
| otherwise = MayHaveCafRefs
pc_bottoming_Id key mod name ty
= pcMiscPrelId key mod name ty bottoming_info
where
+ bottoming_info = hasCafIdInfo `setAllStrictnessInfo` Just strict_sig
+ -- Do *not* mark them as NoCafRefs, because they can indeed have
+ -- CAF refs. For example, pAT_ERROR_ID calls GHC.Err.untangle,
+ -- which has some CAFs
+ -- In due course we may arrange that these error-y things are
+ -- regarded by the GC as permanently live, in which case we
+ -- can give them NoCaf info. As it is, any function that calls
+ -- any pc_bottoming_Id will itself have CafRefs, which bloats
+ -- SRTs.
+
strict_sig = mkStrictSig (mkTopDmdType [evalDmd] BotRes)
- bottoming_info = noCafIdInfo `setAllStrictnessInfo` Just strict_sig
- -- these "bottom" out, no matter what their arguments
+ -- These "bottom" out, no matter what their arguments
(openAlphaTyVar:openBetaTyVar:_) = openAlphaTyVars
openAlphaTy = mkTyVarTy openAlphaTyVar