1 /* ----------------------------------------------------------------------------
2 * $Id: Closures.h,v 1.7 1999/02/05 16:02:21 simonm Exp $
4 * (c) The GHC Team, 1998-1999
8 * -------------------------------------------------------------------------- */
14 * The Layout of a closure header depends on which kind of system we're
15 * compiling for: profiling, parallel, ticky, etc.
18 /* -----------------------------------------------------------------------------
20 -------------------------------------------------------------------------- */
28 #else /* !PROFILING */
34 #endif /* PROFILING */
36 /* -----------------------------------------------------------------------------
38 -------------------------------------------------------------------------- */
54 /* -----------------------------------------------------------------------------
55 The ticky-ticky header
57 Comment from old Ticky.h:
59 This is used to record if a closure has been updated but not yet
60 entered. It is set when the closure is updated and cleared when
63 NB: It is {\em not} an ``entry count'', it is an
64 ``entries-after-update count.''
66 The commoning up of @CONST@, @CHARLIKE@ and @INTLIKE@ closures is
67 turned off(?) if this is required. This has only been done for 2s
68 collection. It is done using a nasty hack which defines the
69 @_Evacuate@ and @_Scavenge@ code for @CONST@, @CHARLIKE@ and @INTLIKE@
70 info tables to be @_Evacuate_1@ and @_Scavenge_1_0@.
71 -------------------------------------------------------------------------- */
87 /* -----------------------------------------------------------------------------
88 The full fixed-size closure header
90 The size of the fixed header is the sum of the optional parts plus a single
91 word for the entry code pointer.
92 -------------------------------------------------------------------------- */
95 const struct _StgInfoTable* info;
103 StgTickyHeader ticky;
107 #define FIXED_HS (sizeof(StgHeader))
109 /* -----------------------------------------------------------------------------
112 For any given closure type (defined in InfoTables.h), there is a
113 corresponding structure defined below. The name of the structure
114 is obtained by concatenating the closure type with '_closure'
115 -------------------------------------------------------------------------- */
117 /* All closures follow the generic format */
119 typedef struct StgClosure_ {
121 struct StgClosure_ *payload[0];
124 /* What a stroke of luck - all our mutable closures follow the same
125 * basic layout, with the mutable link field as the second field after
126 * the header. This means the following structure is the supertype of
130 typedef struct StgMutClosure_ {
133 struct StgMutClosure_ *mut_link;
134 struct StgClosure_ *payload[0];
139 StgClosure *selectee;
166 StgClosure *indirectee;
171 StgClosure *indirectee;
172 StgMutClosure *mut_link;
177 StgClosure *indirectee;
178 StgClosure *static_link;
181 typedef struct StgCAF_ {
185 struct StgCAF_ *link;
190 struct StgTSO_ *blocking_queue;
191 StgMutClosure *mut_link;
203 StgMutClosure *mut_link; /* mutable list */
204 StgClosure *payload[0];
210 StgMutClosure *mut_link;
213 typedef struct _StgUpdateFrame {
215 struct _StgUpdateFrame *link;
221 struct _StgUpdateFrame *link;
226 struct _StgUpdateFrame *link;
242 } StgIntCharlikeClosure;
244 /* statically allocated */
249 typedef struct _StgForeignObj {
251 StgAddr data; /* pointer to data in non-haskell-land */
254 typedef struct _StgStableName {
259 typedef struct _StgWeak { /* Weak v */
262 StgClosure *value; /* v */
263 StgClosure *finaliser;
264 struct _StgWeak *link;
267 /* Dynamic stack frames - these have a liveness mask in the object
268 * itself, rather than in the info table. Useful for generic heap
279 /* Concurrent communication objects */
283 struct StgTSO_ *head;
284 StgMutClosure *mut_link;
285 struct StgTSO_ *tail;
289 /* Parallel FETCH_ME closures */
293 void *ga; /* type globalAddr is abstract here */
297 #endif /* CLOSURES_H */