1 /* ----------------------------------------------------------------------------
2 * $Id: Closures.h,v 1.10 1999/02/26 17:46:04 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;
167 StgClosure *indirectee;
172 StgClosure *indirectee;
173 StgMutClosure *mut_link;
178 StgClosure *indirectee;
179 StgClosure *static_link;
182 typedef struct StgCAF_ {
186 struct StgCAF_ *link;
191 struct StgTSO_ *blocking_queue;
192 StgMutClosure *mut_link;
204 StgMutClosure *mut_link; /* mutable list */
205 StgClosure *payload[0];
211 StgMutClosure *mut_link;
214 typedef struct _StgUpdateFrame {
216 struct _StgUpdateFrame *link;
222 struct _StgUpdateFrame *link;
227 struct _StgUpdateFrame *link;
243 } StgIntCharlikeClosure;
245 /* statically allocated */
250 typedef struct _StgForeignObj {
252 StgAddr data; /* pointer to data in non-haskell-land */
255 typedef struct _StgStableName {
260 typedef struct _StgWeak { /* Weak v */
263 StgClosure *value; /* v */
264 StgClosure *finalizer;
265 struct _StgWeak *link;
268 typedef struct _StgDeadWeak { /* Weak v */
270 struct _StgWeak *link;
273 /* Dynamic stack frames - these have a liveness mask in the object
274 * itself, rather than in the info table. Useful for generic heap
285 /* Concurrent communication objects */
289 struct StgTSO_ *head;
290 StgMutClosure *mut_link;
291 struct StgTSO_ *tail;
295 /* Parallel FETCH_ME closures */
299 void *ga; /* type globalAddr is abstract here */
303 #endif /* CLOSURES_H */