1 /* ----------------------------------------------------------------------------
2 * $Id: Closures.h,v 1.4 1999/01/18 15:21:41 simonm 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;
99 #define FIXED_HS (sizeof(StgHeader))
101 /* -----------------------------------------------------------------------------
104 For any given closure type (defined in InfoTables.h), there is a
105 corresponding structure defined below. The name of the structure
106 is obtained by concatenating the closure type with '_closure'
107 -------------------------------------------------------------------------- */
109 /* All closures follow the generic format */
111 typedef struct StgClosure_ {
113 struct StgClosure_ *payload[0];
116 /* What a stroke of luck - all our mutable closures follow the same
117 * basic layout, with the mutable link field as the second field after
118 * the header. This means the following structure is the supertype of
122 typedef struct StgMutClosure_ {
125 struct StgMutClosure_ *mut_link;
126 struct StgClosure_ *payload[0];
131 StgClosure *selectee;
158 StgClosure *indirectee;
163 StgClosure *indirectee;
164 StgMutClosure *mut_link;
169 StgClosure *indirectee;
170 StgClosure *static_link;
173 typedef struct StgCAF_ {
177 struct StgCAF_ *link;
182 struct StgTSO_ *blocking_queue;
183 StgMutClosure *mut_link;
195 StgMutClosure *mut_link; /* mutable list */
196 StgClosure *payload[0];
202 StgMutClosure *mut_link;
205 typedef struct _StgUpdateFrame {
207 struct _StgUpdateFrame *link;
213 struct _StgUpdateFrame *link;
218 struct _StgUpdateFrame *link;
234 } StgIntCharlikeClosure;
236 /* statically allocated */
241 typedef struct _StgForeignObj {
243 StgAddr data; /* pointer to data in non-haskell-land */
246 typedef struct _StgWeak { /* Weak v */
249 StgClosure *value; /* v */
250 StgClosure *finaliser;
251 struct _StgWeak *link;
254 /* Dynamic stack frames - these have a liveness mask in the object
255 * itself, rather than in the info table. Useful for generic heap
266 /* Concurrent communication objects */
270 struct StgTSO_ *head;
271 StgMutClosure *mut_link;
272 struct StgTSO_ *tail;
276 /* Parallel FETCH_ME closures */
280 void *ga; /* type globalAddr is abstract here */
284 #endif /* CLOSURES_H */