1 /* ----------------------------------------------------------------------------
2 * $Id: InfoTables.h,v 1.11 1999/02/15 12:12:55 simonm Exp $
4 * (c) The GHC Team, 1998-1999
8 * -------------------------------------------------------------------------- */
13 /* -----------------------------------------------------------------------------
15 -------------------------------------------------------------------------- */
19 #define PROF_INFO_WORDS n
25 #else /* !PROFILING */
27 #define PROF_INFO_WORDS 0
33 #endif /* PROFILING */
35 /* -----------------------------------------------------------------------------
37 -------------------------------------------------------------------------- */
41 #define PAR_INFO_WORDS 0
49 #define PAR_INFO_WORDS 0
57 /* -----------------------------------------------------------------------------
59 -------------------------------------------------------------------------- */
63 #define DEBUG_INFO_WORDS n
69 #else /* !DEBUG_CLOSURE */
71 #define DEBUG_INFO_WORDS 0
77 #endif /* DEBUG_CLOSURE */
79 /* -----------------------------------------------------------------------------
82 If you add or delete any closure types, don't forget to update
83 ClosureTypes.h for the native code generator. This is a temporary
85 -------------------------------------------------------------------------- */
89 INVALID_OBJECT /* Object tag 0 raises an internal error */
100 , CONSTR_NOCAF_STATIC
122 , 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)
184 #define isBITMAP(flags) ((flags) &_BTM)
185 #define isTHUNK(flags) ((flags) &_THU)
186 #define isUNPOINTED(flags) ((flags) &_UPT)
187 #define hasSRT(flags) ((flags) &_SRT)
189 #define closure_STATIC(closure) ( get_itbl(closure)->flags & _STA)
190 #define closure_SHOULD_SPARK(closure) (!(get_itbl(closure)->flags & _NS))
191 #define closure_MUTABLE(closure) ( get_itbl(closure)->flags & _MUT)
192 #define closure_UNPOINTED(closure) ( get_itbl(closure)->flags & _UPT)
194 /* HNF BTM NS STA THU MUT UPT SRT */
196 #define FLAGS_CONSTR (_HNF| _NS )
197 #define FLAGS_CONSTR_1_0 (_HNF| _NS )
198 #define FLAGS_CONSTR_0_1 (_HNF| _NS )
199 #define FLAGS_CONSTR_2_0 (_HNF| _NS )
200 #define FLAGS_CONSTR_1_1 (_HNF| _NS )
201 #define FLAGS_CONSTR_0_2 (_HNF| _NS )
202 #define FLAGS_CONSTR_STATIC (_HNF| _NS|_STA )
203 #define FLAGS_CONSTR_NOCAF_STATIC (_HNF| _NS|_STA )
204 #define FLAGS_FUN (_HNF| _NS| _SRT )
205 #define FLAGS_FUN_1_0 (_HNF| _NS )
206 #define FLAGS_FUN_0_1 (_HNF| _NS )
207 #define FLAGS_FUN_2_0 (_HNF| _NS )
208 #define FLAGS_FUN_1_1 (_HNF| _NS )
209 #define FLAGS_FUN_0_2 (_HNF| _NS )
210 #define FLAGS_FUN_STATIC (_HNF| _NS|_STA| _SRT )
211 #define FLAGS_THUNK ( _BTM| _THU| _SRT )
212 #define FLAGS_THUNK_1_0 ( _BTM| _THU| _SRT )
213 #define FLAGS_THUNK_0_1 ( _BTM| _THU| _SRT )
214 #define FLAGS_THUNK_2_0 ( _BTM| _THU| _SRT )
215 #define FLAGS_THUNK_1_1 ( _BTM| _THU| _SRT )
216 #define FLAGS_THUNK_0_2 ( _BTM| _THU| _SRT )
217 #define FLAGS_THUNK_STATIC ( _BTM| _STA|_THU| _SRT )
218 #define FLAGS_THUNK_SELECTOR ( _BTM| _THU| _SRT )
219 #define FLAGS_BCO (_HNF| _NS )
220 #define FLAGS_CAF_UNENTERED 0 /* Do we still use these? */
221 #define FLAGS_CAF_ENTERED 0
222 #define FLAGS_CAF_BLACKHOLE ( _BTM|_NS| _UPT )
223 #define FLAGS_AP_UPD ( _BTM| _THU )
224 #define FLAGS_PAP (_HNF| _NS )
226 #define FLAGS_IND_OLDGEN 0
227 #define FLAGS_IND_PERM 0
228 #define FLAGS_IND_OLDGEN_PERM 0
229 #define FLAGS_IND_STATIC ( _STA )
230 #define FLAGS_EVACUATED 0
231 #define FLAGS_ARR_WORDS (_HNF| _NS| _UPT )
232 #define FLAGS_MUT_ARR_PTRS (_HNF| _NS| _MUT|_UPT )
233 #define FLAGS_MUT_ARR_PTRS_FROZEN (_HNF| _NS| _MUT|_UPT )
234 #define FLAGS_MUT_VAR (_HNF| _NS| _MUT|_UPT )
235 #define FLAGS_FOREIGN (_HNF| _NS| _UPT )
236 #define FLAGS_STABLE_NAME (_HNF| _NS| _UPT )
237 #define FLAGS_WEAK (_HNF| _NS| _UPT )
238 #define FLAGS_BLACKHOLE ( _NS| _UPT )
239 #define FLAGS_BLACKHOLE_BQ ( _NS| _MUT|_UPT )
240 #define FLAGS_MVAR (_HNF| _NS| _MUT|_UPT )
241 #define FLAGS_FETCH_ME (_HNF| _NS )
242 #define FLAGS_TSO (_HNF| _NS| _MUT|_UPT )
243 #define FLAGS_RET_BCO ( _BTM )
244 #define FLAGS_RET_SMALL ( _BTM| _SRT)
245 #define FLAGS_RET_VEC_SMALL ( _BTM| _SRT)
246 #define FLAGS_RET_BIG ( _SRT)
247 #define FLAGS_RET_VEC_BIG ( _SRT)
248 #define FLAGS_RET_DYN ( _SRT)
249 #define FLAGS_CATCH_FRAME ( _BTM )
250 #define FLAGS_STOP_FRAME ( _BTM )
251 #define FLAGS_SEQ_FRAME ( _BTM )
252 #define FLAGS_UPDATE_FRAME ( _BTM )
254 /* -----------------------------------------------------------------------------
256 -------------------------------------------------------------------------- */
258 /* A large bitmap. Small 32-bit ones live in the info table, but sometimes
259 * 32 bits isn't enough and we have to generate a larger one. (sizes
260 * differ for 64-bit machines.
269 * Stuff describing the closure layout. Well, actually, it might
270 * contain the selector index for a THUNK_SELECTOR. If we're on a
271 * 64-bit architecture then we can enlarge some of these fields, since
272 * the union contains a pointer field.
277 StgWord bitmap; /* bit pattern, 1 = pointer, 0 = non-pointer */
278 StgWord selector_offset; /* used in THUNK_SELECTORs */
279 StgLargeBitmap* large_bitmap; /* pointer to large bitmap structure */
281 #if SIZEOF_VOID_P == 8
283 StgNat32 ptrs; /* number of pointers */
284 StgNat32 nptrs; /* number of non-pointers */
288 StgNat16 ptrs; /* number of pointers */
289 StgNat16 nptrs; /* number of non-pointers */
296 * Info tables. All info tables are the same type, to simplify code
297 * generation. However, the mangler removes any unused SRT fields
298 * from the asm to save space (convention: if srt_len is zero, or the
299 * type is a CONSTR_ type, then the SRT field isn't present.
302 typedef StgClosure* StgSRT[];
304 typedef struct _StgInfoTable {
305 StgSRT *srt; /* pointer to the SRT table */
315 StgClosureInfo layout; /* closure layout info (pointer-sized) */
316 #if SIZEOF_VOID_P == 8
317 StgNat16 flags; /* } */
318 StgClosureType type : 16; /* } These 4 elements fit into 64 bits */
319 StgNat32 srt_len; /* } */
321 StgNat8 flags; /* } */
322 StgClosureType type : 8; /* } These 4 elements fit into 32 bits */
323 StgNat16 srt_len; /* } */
325 #if USE_MINIINTERPRETER
326 StgFunPtr (*vector)[];
333 #endif /* INFOTABLES_H */