1 /* -----------------------------------------------------------------------------
2 * $Id: StgRetainerProf.h,v 1.1 2001/11/22 14:25:12 simonmar Exp $
4 * (c) The GHC Team, 2001
7 * ---------------------------------------------------------------------------*/
9 #ifndef STGRETAINERPROF_H
10 #define STGRETAINERPROF_H
13 Type 'retainer' defines the retainer identity.
16 1. The retainer identity of a given retainer cannot change during
17 program execution, no matter where it is actually stored.
18 For instance, the memory address of a retainer cannot be used as
19 its retainer identity because its location may change during garbage
21 2. Type 'retainer' must come with comparison operations as well as
22 an equality operation. That it, <, >, and == must be supported -
23 this is necessary to store retainers in a sorted order in retainer sets.
24 Therefore, you cannot use a huge structure type as 'retainer', for instance.
26 We illustrate three possibilities of defining 'retainer identity'.
27 Choose one of the following three compiler directives:
29 Retainer scheme 1 (RETAINER_SCHEME_INFO) : retainer = info table
30 Retainer scheme 2 (RETAINER_SCHEME_CCS) : retainer = cost centre stack
31 Retainer scheme 3 (RETAINER_SCHEME_CC) : retainer = cost centre
34 // #define RETAINER_SCHEME_INFO
35 #define RETAINER_SCHEME_CCS
36 // #define RETAINER_SCHEME_CC
38 #ifdef RETAINER_SCHEME_INFO
40 typedef struct _StgInfoTable *retainer;
43 #ifdef RETAINER_SCHEME_CCS
44 typedef CostCentreStack *retainer;
47 #ifdef RETAINER_SCHEME_CC
48 typedef CostCentre *retainer;
52 Type 'retainerSet' defines an abstract datatype for sets of retainers.
55 A retainer set stores its elements in increasing order (in element[] array).
58 typedef struct _RetainerSet {
59 nat num; // number of elements
60 nat cost; // cost associated with this retainer set
61 StgWord hashKey; // hash key for this retainer set
62 struct _RetainerSet *link; // link to the next retainer set in the bucket
63 int id; // unique id of this retainer set (used when printing)
64 // Its absolute value is interpreted as its true id; if id is
65 // negative, it indicates that this retainer set has had a postive
66 // cost after some retainer profiling.
67 retainer element[0]; // elements of this retainer set
68 // do not put anything below here!
72 // retainerSet - interface: see rts/RetainerSet.h
75 #endif /* STGRETAINERPROF_H */