1 /* ----------------------------------------------------------------------------
2 * $Id: InfoMacros.h,v 1.2 1998/12/02 13:21:09 simonm Exp $
4 * Macros for building and deconstructing info tables.
6 * -------------------------------------------------------------------------- */
11 #define STD_INFO(type_) \
17 #define SRT_INFO(type_,srt_,srt_off_,srt_len_) \
18 srt : (StgSRT *)((StgClosure **)srt_+srt_off_), \
23 /* function/thunk info tables --------------------------------------------- */
26 INFO_TABLE_SRT(info, /* info-table label */ \
27 entry, /* entry code label */ \
28 ptrs, nptrs, /* closure layout info */\
29 srt_, srt_off_, srt_len_, /* SRT info */ \
30 type, /* closure type */ \
31 info_class, entry_class, /* C storage classes */ \
32 prof_descr, prof_type) /* profiling info */ \
34 info_class StgInfoTable info = { \
35 layout : { payload : {ptrs,nptrs} }, \
36 SRT_INFO(type,srt_,srt_off_,srt_len_), \
41 /* direct-return address info tables --------------------------------------*/
44 INFO_TABLE_SRT_BITMAP(info, entry, bitmap_, srt_, srt_off_, srt_len_, \
45 type, info_class, entry_class, \
46 prof_descr, prof_type) \
48 info_class StgInfoTable info = { \
49 layout : { bitmap : (StgNat32)bitmap_ },\
50 SRT_INFO(type,srt_,srt_off_,srt_len_), \
54 /* info-table without an SRT -----------------------------------------------*/
57 INFO_TABLE(info, entry, ptrs, nptrs, type, info_class, \
58 entry_class, prof_descr, prof_type) \
60 info_class StgInfoTable info = { \
61 layout : { payload : {ptrs,nptrs} }, \
66 /* special selector-thunk info table ---------------------------------------*/
69 INFO_TABLE_SELECTOR(info, entry, offset, info_class, \
70 entry_class, prof_descr, prof_type) \
72 info_class StgInfoTable info = { \
73 layout : { selector_offset : offset }, \
74 STD_INFO(THUNK_SELECTOR), \
78 /* constructor info table --------------------------------------------------*/
81 INFO_TABLE_CONSTR(info, entry, ptrs, nptrs, tag_,type_,info_class, \
82 entry_class, prof_descr, prof_type) \
84 info_class StgInfoTable info = { \
85 layout : { payload : {ptrs,nptrs} }, \
88 flags : FLAGS_##type_, \
92 #define constrTag(con) (get_itbl(con)->srt_len)
94 /* return-vectors ----------------------------------------------------------*/
96 /* vectored-return info tables have the vector slammed up against the
97 * start of the info table.
99 * A vectored-return address always has an SRT and a bitmap-style
100 * layout field, so we only need one macro for these.
138 #define VEC_INFO_TABLE(bitmap_,srt_,srt_off_,srt_len_,type) \
140 layout : { bitmap : (StgNat32)bitmap_ }, \
141 SRT_INFO(type,srt_,srt_off_,srt_len_) \
144 /* For polymorphic activation records, we need both a direct return
145 * address and a return vector:
148 #ifdef USE_MINIINTERPRETER
149 typedef StgInfoTable StgPolyInfoTable;
150 #define POLY_VEC(nm) \
161 #define VEC_POLY_INFO_TABLE(nm,bitmap_,srt_,srt_off_,srt_len_,type) \
162 StgFunPtr nm##_vec[8] = POLY_VEC(nm); \
163 const StgInfoTable nm##_info = { \
164 layout : { bitmap : (StgNat32)bitmap_ }, \
165 SRT_INFO(type,srt_,srt_off_,srt_len_), \
166 vector : &nm##_vec, \
167 INIT_ENTRY(nm##_entry) \
170 typedef vec_info_8 StgPolyInfoTable;
171 #define POLY_VEC(nm) \
182 #define VEC_POLY_INFO_TABLE(nm,bitmap_,srt_,srt_off_,srt_len_,type) \
183 const vec_info_8 nm##_info = { \
184 vec : POLY_VEC(nm), \
186 layout : { bitmap : (StgNat32)bitmap_ }, \
187 SRT_INFO(type,srt_,srt_off_,srt_len_), \
188 INIT_ENTRY(nm##_entry) \
194 static const StgSRT lbl = {
196 #define BITMAP(lbl,size) \
197 static const StgLargeBitmap lbl = { size, {
199 #endif /* INFOMACROS_H */