1 /* ----------------------------------------------------------------------------
2 * $Id: InfoTables.h,v 1.2 1998/12/02 13:21:10 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 */
106 , PAP /* should be called AP_NUPD */
137 , MUT_ARR_PTRS_FROZEN
150 , N_CLOSURE_TYPES /* number of distinct closure types */
154 /* The type flags provide quick access to certain properties of a closure. */
156 #define _HNF (1<<0) /* head normal form? */
157 #define _BTM (1<<1) /* bitmap-style layout? */
158 #define _NS (1<<2) /* non-sparkable */
159 #define _STA (1<<3) /* static? */
160 #define _THU (1<<4) /* thunk? */
161 #define _MUT (1<<5) /* mutable? */
162 #define _UPT (1<<6) /* unpointed? */
163 #define _SRT (1<<7) /* has an SRT? */
165 #define isSTATIC(flags) ((flags)&_STA)
166 #define closure_STATIC(closure) ( get_itbl(closure)->flags & _STA)
167 #define closure_SHOULD_SPARK(closure) (!(get_itbl(closure)->flags & _NS))
168 #define closure_UNPOINTED(closure) ( get_itbl(closure)->flags & _UPT)
170 /* HNF BTM NS STA THU MUT UPT SRT */
172 #define FLAGS_CONSTR (_HNF| _NS )
173 #define FLAGS_CONSTR_STATIC (_HNF| _NS|_STA )
174 #define FLAGS_CONSTR_NOCAF_STATIC (_HNF| _NS|_STA )
175 #define FLAGS_FUN (_HNF| _NS| _SRT )
176 #define FLAGS_FUN_STATIC (_HNF| _NS|_STA| _SRT )
177 #define FLAGS_THUNK ( _BTM| _THU| _SRT )
178 #define FLAGS_THUNK_STATIC ( _BTM| _STA|_THU| _SRT )
179 #define FLAGS_THUNK_SELECTOR ( _BTM| _THU| _SRT )
180 #define FLAGS_BCO (_HNF| _NS )
181 #define FLAGS_CAF_UNENTERED 0 /* Do we still use these? */
182 #define FLAGS_CAF_ENTERED 0
183 #define FLAGS_CAF_BLACKHOLE ( _BTM|_NS| _UPT )
184 #define FLAGS_AP_UPD ( _BTM| _THU )
185 #define FLAGS_PAP (_HNF| _NS )
187 #define FLAGS_IND_OLDGEN 0
188 #define FLAGS_IND_PERM 0
189 #define FLAGS_IND_OLDGEN_PERM 0
190 #define FLAGS_IND_STATIC ( _STA )
191 #define FLAGS_EVACUATED 0
192 #define FLAGS_ARR_WORDS (_HNF| _NS| _UPT )
193 #define FLAGS_MUT_ARR_WORDS (_HNF| _NS| _MUT|_UPT )
194 #define FLAGS_ARR_PTRS (_HNF| _NS| _UPT )
195 #define FLAGS_MUT_ARR_PTRS (_HNF| _NS| _MUT|_UPT )
196 #define FLAGS_MUT_ARR_PTRS_FROZEN (_HNF| _NS| _MUT|_UPT )
197 #define FLAGS_MUT_VAR (_HNF| _NS| _MUT|_UPT )
198 #define FLAGS_FOREIGN (_HNF| _NS| _UPT )
199 #define FLAGS_WEAK (_HNF| _NS| _UPT )
200 #define FLAGS_BLACKHOLE ( _BTM|_NS| _UPT )
201 #define FLAGS_MVAR (_HNF| _NS| _UPT )
202 #define FLAGS_FETCH_ME (_HNF| _NS )
204 #define FLAGS_RET_BCO ( _BTM )
205 #define FLAGS_RET_SMALL ( _BTM| _SRT)
206 #define FLAGS_RET_VEC_SMALL ( _BTM| _SRT)
207 #define FLAGS_RET_BIG ( _SRT)
208 #define FLAGS_RET_VEC_BIG ( _SRT)
209 #define FLAGS_RET_DYN ( _SRT)
210 #define FLAGS_CATCH_FRAME 0
211 #define FLAGS_STOP_FRAME 0
212 #define FLAGS_SEQ_FRAME 0
213 #define FLAGS_UPDATE_FRAME 0
215 /* -----------------------------------------------------------------------------
217 -------------------------------------------------------------------------- */
219 /* A large bitmap. Small 32-bit ones live in the info table, but sometimes
220 * 32 bits isn't enough and we have to generate a larger one.
229 * Stuff describing the closure layout. Well, actually, it might
230 * contain the selector index for a THUNK_SELECTOR.
235 StgNat32 bitmap; /* bit pattern, 1 = pointer, 0 = non-pointer */
237 StgLargeBitmap* large_bitmap; /* pointer to large bitmap structure */
240 StgNat16 ptrs; /* number of pointers */
241 StgNat16 nptrs; /* number of non-pointers */
244 StgNat32 selector_offset; /* used in THUNK_SELECTORs */
249 * Info tables. All info tables are the same type, to simplify code
250 * generation. However, the mangler removes any unused SRT fields
251 * from the asm to save space (convention: if srt_len is zero, or the
252 * type is a CONSTR_ type, then the SRT field isn't present.
255 typedef StgClosure* StgSRT[];
257 typedef struct _StgInfoTable {
258 StgSRT *srt; /* pointer to the SRT table */
262 StgClosureInfo layout; /* closure layout info */
263 StgNat8 flags; /* } */
264 StgClosureType type : 8; /* } These 4 elements fit into 32 bits */
265 StgNat16 srt_len; /* } */
266 #if USE_MINIINTERPRETER
267 StgFunPtr (*vector)[];
274 #endif /* INFOTABLES_H */