%
% (c) The GRASP/AQUA Project, Glasgow University, 1992-1998
%
-% $Id: CLabel.lhs,v 1.25 1999/04/27 12:34:49 simonm Exp $
+% $Id: CLabel.lhs,v 1.30 1999/12/02 17:57:13 simonmar Exp $
%
\section[CLabel]{@CLabel@: Information to make C Labels}
mkAsmTempLabel,
mkErrorStdEntryLabel,
- mkUpdEntryLabel,
+ mkUpdInfoLabel,
+ mkTopTickyCtrLabel,
mkBlackHoleInfoTableLabel,
+ mkCAFBlackHoleInfoTableLabel,
+ mkSECAFBlackHoleInfoTableLabel,
mkRtsPrimOpLabel,
mkSelectorInfoLabel,
mkCC_Label, mkCCS_Label,
- needsCDecl, isReadOnly, isAsmTemp, externallyVisibleCLabel,
+ needsCDecl, isAsmTemp, externallyVisibleCLabel,
CLabelType(..), labelType, labelDynamic,
import {-# SOURCE #-} MachMisc ( underscorePrefix, fmtAsmLbl )
#endif
-import CmdLineOpts ( opt_Static )
+import CmdLineOpts ( opt_Static, opt_DoTickyProfiling )
import CStrings ( pp_cSEP )
import DataCon ( ConTag, DataCon )
import Module ( isDynamicModule )
data RtsLabelInfo
= RtsShouldNeverHappenCode
- | RtsBlackHoleInfoTbl
+ | RtsBlackHoleInfoTbl FAST_STRING -- black hole with info table name
- | RtsUpdEntry
+ | RtsUpdInfo
| RtsSelectorInfoTbl Bool{-updatable-} Int{-offset-} -- Selector thunks
| RtsSelectorEntry Bool{-updatable-} Int{-offset-}
| RtsPrimOp PrimOp
+ | RtsTopTickyCtr
+
deriving (Eq, Ord)
-- Label Type: for generating C declarations.
-- Some fixed runtime system labels
mkErrorStdEntryLabel = RtsLabel RtsShouldNeverHappenCode
-mkUpdEntryLabel = RtsLabel RtsUpdEntry
-mkBlackHoleInfoTableLabel = RtsLabel RtsBlackHoleInfoTbl
+mkUpdInfoLabel = RtsLabel RtsUpdInfo
+mkTopTickyCtrLabel = RtsLabel RtsTopTickyCtr
+mkBlackHoleInfoTableLabel = RtsLabel (RtsBlackHoleInfoTbl SLIT("BLACKHOLE_info"))
+mkCAFBlackHoleInfoTableLabel = RtsLabel (RtsBlackHoleInfoTbl SLIT("CAF_BLACKHOLE_info"))
+mkSECAFBlackHoleInfoTableLabel = if opt_DoTickyProfiling then
+ RtsLabel (RtsBlackHoleInfoTbl SLIT("SE_CAF_BLACKHOLE_info"))
+ else -- RTS won't have info table unless -ticky is on
+ panic "mkSECAFBlackHoleInfoTableLabel requires -ticky"
mkRtsPrimOpLabel primop = RtsLabel (RtsPrimOp primop)
mkSelectorInfoLabel upd off = RtsLabel (RtsSelectorInfoTbl upd off)
\begin{code}
needsCDecl :: CLabel -> Bool -- False <=> it's pre-declared; don't bother
-isReadOnly :: CLabel -> Bool -- lives in C "text space"
isAsmTemp :: CLabel -> Bool -- is a local temporary for native code generation
externallyVisibleCLabel :: CLabel -> Bool -- not C "static"
\end{code}
needsCDecl (CCS_Label _) = False
\end{code}
-Whether the labelled thing can be put in C "text space":
-
-\begin{code}
-isReadOnly (IdLabel _ InfoTbl) = True -- info-tables: yes
-isReadOnly (IdLabel _ other) = False -- others: pessimistically, no
-
-isReadOnly (DataConLabel _ _) = True -- and so on, for other
-isReadOnly (TyConLabel _) = True
-isReadOnly (CaseLabel _ _) = True
-isReadOnly (AsmTempLabel _) = True
-isReadOnly (RtsLabel _) = True
-isReadOnly (CC_Label _) = True
-isReadOnly (CCS_Label _) = True
-\end{code}
-
Whether the label is an assembler temporary:
\begin{code}
\begin{code}
labelType :: CLabel -> CLabelType
-labelType (RtsLabel RtsBlackHoleInfoTbl) = InfoTblType
+labelType (RtsLabel (RtsBlackHoleInfoTbl _)) = InfoTblType
labelType (RtsLabel (RtsSelectorInfoTbl _ _)) = InfoTblType
labelType (RtsLabel (RtsApInfoTbl _ _)) = InfoTblType
+labelType (RtsLabel RtsUpdInfo) = InfoTblType
labelType (CaseLabel _ CaseReturnInfo) = InfoTblType
labelType (CaseLabel _ CaseReturnPt) = CodeType
labelType (CaseLabel _ CaseVecTbl) = VecTblType
static_info Static Constructor info table
sel_info Selector info table
sel_entry Selector entry code
+ cc Cost centre
+ ccs Cost centre stack
\begin{code}
-- specialised for PprAsm: saves lots of arg passing in NCG
pprCLbl (RtsLabel RtsShouldNeverHappenCode) = ptext SLIT("stg_error_entry")
-pprCLbl (RtsLabel RtsUpdEntry) = ptext SLIT("Upd_frame_entry")
+pprCLbl (RtsLabel RtsUpdInfo) = ptext SLIT("Upd_frame_info")
+
+pprCLbl (RtsLabel RtsTopTickyCtr) = ptext SLIT("top_ct")
-pprCLbl (RtsLabel RtsBlackHoleInfoTbl) = ptext SLIT("CAF_BLACKHOLE_info")
+pprCLbl (RtsLabel (RtsBlackHoleInfoTbl info)) = ptext info
pprCLbl (RtsLabel (RtsSelectorInfoTbl upd_reqd offset))
= hcat [ptext SLIT("__sel_"), text (show offset),