1 /* ----------------------------------------------------------------------------
2 * $Id: Closures.h,v 1.6 1999/02/05 12:41:31 sof Exp $
6 * -------------------------------------------------------------------------- */
12 * The Layout of a closure header depends on which kind of system we're
13 * compiling for: profiling, parallel, ticky, etc.
16 /* -----------------------------------------------------------------------------
18 -------------------------------------------------------------------------- */
26 #else /* !PROFILING */
32 #endif /* PROFILING */
34 /* -----------------------------------------------------------------------------
36 -------------------------------------------------------------------------- */
52 /* -----------------------------------------------------------------------------
53 The ticky-ticky header
55 Comment from old Ticky.h:
57 This is used to record if a closure has been updated but not yet
58 entered. It is set when the closure is updated and cleared when
61 NB: It is {\em not} an ``entry count'', it is an
62 ``entries-after-update count.''
64 The commoning up of @CONST@, @CHARLIKE@ and @INTLIKE@ closures is
65 turned off(?) if this is required. This has only been done for 2s
66 collection. It is done using a nasty hack which defines the
67 @_Evacuate@ and @_Scavenge@ code for @CONST@, @CHARLIKE@ and @INTLIKE@
68 info tables to be @_Evacuate_1@ and @_Scavenge_1_0@.
69 -------------------------------------------------------------------------- */
85 /* -----------------------------------------------------------------------------
86 The full fixed-size closure header
88 The size of the fixed header is the sum of the optional parts plus a single
89 word for the entry code pointer.
90 -------------------------------------------------------------------------- */
93 const struct _StgInfoTable* info;
101 StgTickyHeader ticky;
105 #define FIXED_HS (sizeof(StgHeader))
107 /* -----------------------------------------------------------------------------
110 For any given closure type (defined in InfoTables.h), there is a
111 corresponding structure defined below. The name of the structure
112 is obtained by concatenating the closure type with '_closure'
113 -------------------------------------------------------------------------- */
115 /* All closures follow the generic format */
117 typedef struct StgClosure_ {
119 struct StgClosure_ *payload[0];
122 /* What a stroke of luck - all our mutable closures follow the same
123 * basic layout, with the mutable link field as the second field after
124 * the header. This means the following structure is the supertype of
128 typedef struct StgMutClosure_ {
131 struct StgMutClosure_ *mut_link;
132 struct StgClosure_ *payload[0];
137 StgClosure *selectee;
164 StgClosure *indirectee;
169 StgClosure *indirectee;
170 StgMutClosure *mut_link;
175 StgClosure *indirectee;
176 StgClosure *static_link;
179 typedef struct StgCAF_ {
183 struct StgCAF_ *link;
188 struct StgTSO_ *blocking_queue;
189 StgMutClosure *mut_link;
201 StgMutClosure *mut_link; /* mutable list */
202 StgClosure *payload[0];
208 StgMutClosure *mut_link;
211 typedef struct _StgUpdateFrame {
213 struct _StgUpdateFrame *link;
219 struct _StgUpdateFrame *link;
224 struct _StgUpdateFrame *link;
240 } StgIntCharlikeClosure;
242 /* statically allocated */
247 typedef struct _StgForeignObj {
249 StgAddr data; /* pointer to data in non-haskell-land */
252 typedef struct _StgStableName {
257 typedef struct _StgWeak { /* Weak v */
260 StgClosure *value; /* v */
261 StgClosure *finaliser;
262 struct _StgWeak *link;
265 /* Dynamic stack frames - these have a liveness mask in the object
266 * itself, rather than in the info table. Useful for generic heap
277 /* Concurrent communication objects */
281 struct StgTSO_ *head;
282 StgMutClosure *mut_link;
283 struct StgTSO_ *tail;
287 /* Parallel FETCH_ME closures */
291 void *ga; /* type globalAddr is abstract here */
295 #endif /* CLOSURES_H */