1 /* ----------------------------------------------------------------------------
2 * $Id: InfoTables.h,v 1.7 1999/01/26 16:16:21 simonm Exp $
6 * -------------------------------------------------------------------------- */
11 /* -----------------------------------------------------------------------------
13 -------------------------------------------------------------------------- */
17 #define PROF_INFO_WORDS n
23 #else /* !PROFILING */
25 #define PROF_INFO_WORDS 0
31 #endif /* PROFILING */
33 /* -----------------------------------------------------------------------------
35 -------------------------------------------------------------------------- */
39 #define PAR_INFO_WORDS 0
47 #define PAR_INFO_WORDS 0
55 /* -----------------------------------------------------------------------------
57 -------------------------------------------------------------------------- */
61 #define DEBUG_INFO_WORDS n
67 #else /* !DEBUG_CLOSURE */
69 #define DEBUG_INFO_WORDS 0
75 #endif /* DEBUG_CLOSURE */
77 /* -----------------------------------------------------------------------------
80 If you add or delete any closure types, don't forget to update
81 ClosureTypes.h for the native code generator. This is a temporary
83 -------------------------------------------------------------------------- */
87 INVALID_OBJECT /* Object tag 0 raises an internal error */
120 , PAP /* should be called AP_NUPD */
152 , MUT_ARR_PTRS_FROZEN
167 , N_CLOSURE_TYPES /* number of distinct closure types */
171 /* The type flags provide quick access to certain properties of a closure. */
173 #define _HNF (1<<0) /* head normal form? */
174 #define _BTM (1<<1) /* bitmap-style layout? */
175 #define _NS (1<<2) /* non-sparkable */
176 #define _STA (1<<3) /* static? */
177 #define _THU (1<<4) /* thunk? */
178 #define _MUT (1<<5) /* mutable? */
179 #define _UPT (1<<6) /* unpointed? */
180 #define _SRT (1<<7) /* has an SRT? */
182 #define isSTATIC(flags) ((flags)&_STA)
183 #define isMUTABLE(flags) ((flags) &_MUT)
185 #define closure_STATIC(closure) ( get_itbl(closure)->flags & _STA)
186 #define closure_SHOULD_SPARK(closure) (!(get_itbl(closure)->flags & _NS))
187 #define closure_MUTABLE(closure) ( get_itbl(closure)->flags & _MUT)
188 #define closure_UNPOINTED(closure) ( get_itbl(closure)->flags & _UPT)
190 /* HNF BTM NS STA THU MUT UPT SRT */
192 #define FLAGS_CONSTR (_HNF| _NS )
193 #define FLAGS_CONSTR_1_0 (_HNF| _NS )
194 #define FLAGS_CONSTR_0_1 (_HNF| _NS )
195 #define FLAGS_CONSTR_2_0 (_HNF| _NS )
196 #define FLAGS_CONSTR_1_1 (_HNF| _NS )
197 #define FLAGS_CONSTR_0_2 (_HNF| _NS )
198 #define FLAGS_CONSTR_STATIC (_HNF| _NS|_STA )
199 #define FLAGS_CONSTR_NOCAF_STATIC (_HNF| _NS|_STA )
200 #define FLAGS_FUN (_HNF| _NS| _SRT )
201 #define FLAGS_FUN_1_0 (_HNF| _NS )
202 #define FLAGS_FUN_0_1 (_HNF| _NS )
203 #define FLAGS_FUN_2_0 (_HNF| _NS )
204 #define FLAGS_FUN_1_1 (_HNF| _NS )
205 #define FLAGS_FUN_0_2 (_HNF| _NS )
206 #define FLAGS_FUN_STATIC (_HNF| _NS|_STA| _SRT )
207 #define FLAGS_THUNK ( _BTM| _THU| _SRT )
208 #define FLAGS_THUNK_1_0 ( _BTM| _THU| _SRT )
209 #define FLAGS_THUNK_0_1 ( _BTM| _THU| _SRT )
210 #define FLAGS_THUNK_2_0 ( _BTM| _THU| _SRT )
211 #define FLAGS_THUNK_1_1 ( _BTM| _THU| _SRT )
212 #define FLAGS_THUNK_0_2 ( _BTM| _THU| _SRT )
213 #define FLAGS_THUNK_STATIC ( _BTM| _STA|_THU| _SRT )
214 #define FLAGS_THUNK_SELECTOR ( _BTM| _THU| _SRT )
215 #define FLAGS_BCO (_HNF| _NS )
216 #define FLAGS_CAF_UNENTERED 0 /* Do we still use these? */
217 #define FLAGS_CAF_ENTERED 0
218 #define FLAGS_CAF_BLACKHOLE ( _BTM|_NS| _UPT )
219 #define FLAGS_AP_UPD ( _BTM| _THU )
220 #define FLAGS_PAP (_HNF| _NS )
222 #define FLAGS_IND_OLDGEN 0
223 #define FLAGS_IND_PERM 0
224 #define FLAGS_IND_OLDGEN_PERM 0
225 #define FLAGS_IND_STATIC ( _STA )
226 #define FLAGS_EVACUATED 0
227 #define FLAGS_ARR_WORDS (_HNF| _NS| _UPT )
228 #define FLAGS_MUT_ARR_WORDS (_HNF| _NS| _MUT|_UPT )
229 #define FLAGS_MUT_ARR_PTRS (_HNF| _NS| _MUT|_UPT )
230 #define FLAGS_MUT_ARR_PTRS_FROZEN (_HNF| _NS| _MUT|_UPT )
231 #define FLAGS_MUT_VAR (_HNF| _NS| _MUT|_UPT )
232 #define FLAGS_FOREIGN (_HNF| _NS| _UPT )
233 #define FLAGS_STABLE_NAME (_HNF| _NS| _UPT )
234 #define FLAGS_WEAK (_HNF| _NS| _UPT )
235 #define FLAGS_BLACKHOLE ( _NS| _UPT )
236 #define FLAGS_BLACKHOLE_BQ ( _NS| _MUT|_UPT )
237 #define FLAGS_MVAR (_HNF| _NS| _MUT|_UPT )
238 #define FLAGS_FETCH_ME (_HNF| _NS )
239 #define FLAGS_TSO (_HNF| _NS| _MUT|_UPT )
240 #define FLAGS_RET_BCO ( _BTM )
241 #define FLAGS_RET_SMALL ( _BTM| _SRT)
242 #define FLAGS_RET_VEC_SMALL ( _BTM| _SRT)
243 #define FLAGS_RET_BIG ( _SRT)
244 #define FLAGS_RET_VEC_BIG ( _SRT)
245 #define FLAGS_RET_DYN ( _SRT)
246 #define FLAGS_CATCH_FRAME ( _BTM )
247 #define FLAGS_STOP_FRAME ( _BTM )
248 #define FLAGS_SEQ_FRAME ( _BTM )
249 #define FLAGS_UPDATE_FRAME ( _BTM )
251 /* -----------------------------------------------------------------------------
253 -------------------------------------------------------------------------- */
255 /* A large bitmap. Small 32-bit ones live in the info table, but sometimes
256 * 32 bits isn't enough and we have to generate a larger one. (sizes
257 * differ for 64-bit machines.
266 * Stuff describing the closure layout. Well, actually, it might
267 * contain the selector index for a THUNK_SELECTOR. If we're on a
268 * 64-bit architecture then we can enlarge some of these fields, since
269 * the union contains a pointer field.
274 StgWord bitmap; /* bit pattern, 1 = pointer, 0 = non-pointer */
275 StgWord selector_offset; /* used in THUNK_SELECTORs */
276 StgLargeBitmap* large_bitmap; /* pointer to large bitmap structure */
278 #if SIZEOF_VOID_P == 8
280 StgNat32 ptrs; /* number of pointers */
281 StgNat32 nptrs; /* number of non-pointers */
285 StgNat16 ptrs; /* number of pointers */
286 StgNat16 nptrs; /* number of non-pointers */
293 * Info tables. All info tables are the same type, to simplify code
294 * generation. However, the mangler removes any unused SRT fields
295 * from the asm to save space (convention: if srt_len is zero, or the
296 * type is a CONSTR_ type, then the SRT field isn't present.
299 typedef StgClosure* StgSRT[];
301 typedef struct _StgInfoTable {
302 StgSRT *srt; /* pointer to the SRT table */
306 StgClosureInfo layout; /* closure layout info (pointer-sized) */
307 #if SIZEOF_VOID_P == 8
308 StgNat16 flags; /* } */
309 StgClosureType type : 16; /* } These 4 elements fit into 64 bits */
310 StgNat32 srt_len; /* } */
312 StgNat8 flags; /* } */
313 StgClosureType type : 8; /* } These 4 elements fit into 32 bits */
314 StgNat16 srt_len; /* } */
316 #if USE_MINIINTERPRETER
317 StgFunPtr (*vector)[];
324 #endif /* INFOTABLES_H */