1 /* ----------------------------------------------------------------------------
2 * $Id: InfoMacros.h,v 1.3 1999/02/05 16:02:22 simonm Exp $
4 * (c) The GHC Team, 1998-1999
6 * Macros for building and deconstructing info tables.
8 * -------------------------------------------------------------------------- */
13 #define STD_INFO(type_) \
19 #define SRT_INFO(type_,srt_,srt_off_,srt_len_) \
20 srt : (StgSRT *)((StgClosure **)srt_+srt_off_), \
25 /* function/thunk info tables --------------------------------------------- */
28 INFO_TABLE_SRT(info, /* info-table label */ \
29 entry, /* entry code label */ \
30 ptrs, nptrs, /* closure layout info */\
31 srt_, srt_off_, srt_len_, /* SRT info */ \
32 type, /* closure type */ \
33 info_class, entry_class, /* C storage classes */ \
34 prof_descr, prof_type) /* profiling info */ \
36 info_class StgInfoTable info = { \
37 layout : { payload : {ptrs,nptrs} }, \
38 SRT_INFO(type,srt_,srt_off_,srt_len_), \
43 /* direct-return address info tables --------------------------------------*/
46 INFO_TABLE_SRT_BITMAP(info, entry, bitmap_, srt_, srt_off_, srt_len_, \
47 type, info_class, entry_class, \
48 prof_descr, prof_type) \
50 info_class StgInfoTable info = { \
51 layout : { bitmap : (StgNat32)bitmap_ },\
52 SRT_INFO(type,srt_,srt_off_,srt_len_), \
56 /* info-table without an SRT -----------------------------------------------*/
59 INFO_TABLE(info, entry, ptrs, nptrs, type, info_class, \
60 entry_class, prof_descr, prof_type) \
62 info_class StgInfoTable info = { \
63 layout : { payload : {ptrs,nptrs} }, \
68 /* special selector-thunk info table ---------------------------------------*/
71 INFO_TABLE_SELECTOR(info, entry, offset, info_class, \
72 entry_class, prof_descr, prof_type) \
74 info_class StgInfoTable info = { \
75 layout : { selector_offset : offset }, \
76 STD_INFO(THUNK_SELECTOR), \
80 /* constructor info table --------------------------------------------------*/
83 INFO_TABLE_CONSTR(info, entry, ptrs, nptrs, tag_,type_,info_class, \
84 entry_class, prof_descr, prof_type) \
86 info_class StgInfoTable info = { \
87 layout : { payload : {ptrs,nptrs} }, \
90 flags : FLAGS_##type_, \
94 #define constrTag(con) (get_itbl(con)->srt_len)
96 /* return-vectors ----------------------------------------------------------*/
98 /* vectored-return info tables have the vector slammed up against the
99 * start of the info table.
101 * A vectored-return address always has an SRT and a bitmap-style
102 * layout field, so we only need one macro for these.
140 #define VEC_INFO_TABLE(bitmap_,srt_,srt_off_,srt_len_,type) \
142 layout : { bitmap : (StgNat32)bitmap_ }, \
143 SRT_INFO(type,srt_,srt_off_,srt_len_) \
146 /* For polymorphic activation records, we need both a direct return
147 * address and a return vector:
150 #ifdef USE_MINIINTERPRETER
151 typedef StgInfoTable StgPolyInfoTable;
152 #define POLY_VEC(nm) \
163 #define VEC_POLY_INFO_TABLE(nm,bitmap_,srt_,srt_off_,srt_len_,type) \
164 StgFunPtr nm##_vec[8] = POLY_VEC(nm); \
165 const StgInfoTable nm##_info = { \
166 layout : { bitmap : (StgNat32)bitmap_ }, \
167 SRT_INFO(type,srt_,srt_off_,srt_len_), \
168 vector : &nm##_vec, \
169 INIT_ENTRY(nm##_entry) \
172 typedef vec_info_8 StgPolyInfoTable;
173 #define POLY_VEC(nm) \
184 #define VEC_POLY_INFO_TABLE(nm,bitmap_,srt_,srt_off_,srt_len_,type) \
185 const vec_info_8 nm##_info = { \
186 vec : POLY_VEC(nm), \
188 layout : { bitmap : (StgNat32)bitmap_ }, \
189 SRT_INFO(type,srt_,srt_off_,srt_len_), \
190 INIT_ENTRY(nm##_entry) \
196 static const StgSRT lbl = {
198 #define BITMAP(lbl,size) \
199 static const StgLargeBitmap lbl = { size, {
201 #endif /* INFOMACROS_H */