[project @ 2002-04-23 17:16:01 by ken]
[ghc-hetmet.git] / ghc / includes / InfoMacros.h
1 /* ----------------------------------------------------------------------------
2  * $Id: InfoMacros.h,v 1.18 2002/02/26 05:03:27 sof Exp $
3  * 
4  * (c) The GHC Team, 1998-1999
5  *
6  * Macros for building and deconstructing info tables.
7  *
8  * -------------------------------------------------------------------------- */
9
10 #ifndef INFOMACROS_H
11 #define INFOMACROS_H
12
13 #define STD_INFO(type_)                         \
14                 srt : 0,                        \
15                 srt_len : 0,                    \
16                 type : type_
17
18 #define SRT_INFO(type_,srt_,srt_off_,srt_len_)                  \
19                 srt : (StgSRT *)((StgClosure **)srt_+srt_off_), \
20                 srt_len : srt_len_,                             \
21                 type : type_
22
23 #define CONSTR_INFO(type_,tag_)                 \
24                 srt : 0,                        \
25                 srt_len : tag_,                 \
26                 type : type_
27
28 #ifdef PROFILING
29 #define PROF_INFO(type_str, desc_str)           \
30                 prof: {                         \
31                    closure_type: type_str,      \
32                    closure_desc: desc_str,      \
33                 },
34 #else
35 #define PROF_INFO(type_str, desc_str)
36 #endif
37
38 /* Why no empty array initializer in the 'else' branch? sof 2/02 */
39 #ifdef USE_MINIINTERPRETER
40 #define INIT_VECTOR vector : {}
41 #else
42 #define INIT_VECTOR
43 #endif
44
45 /*
46   On the GranSim/GUM specific parts of the InfoTables (GRAN/PAR):
47
48   In both GranSim and GUM we use revertible black holes (RBH) when putting
49   an updatable closure into a packet for communication. The entry code for
50   an RBH performs standard blocking (as with any kind of BH). The info
51   table for the RBH resides just before the one for the std info
52   table. (NB: there is one RBH ITBL for every ITBL of an updatable
53   closure.) The @rbh_infoptr@ field in the ITBL points from the std ITBL to
54   the RBH ITBL and vice versa. This is used by the RBH_INFOPTR and
55   REVERT_INFOPTR macros to turn an updatable node into an RBH and vice
56   versa. Note, that the only case where we have to revert the RBH in its
57   original form is when a packet is sent back because of garbage collection
58   on another PE. In the RTS for GdH we will use this reversion mechanism in 
59   order to deal with faults in the system. 
60   ToDo: Check that RBHs are needed for all the info tables below. From a quick
61   check of the macros generated in the libs it seems that all of them are used
62   for generating THUNKs.
63   Possible optimisation: Note that any RBH ITBL is a fixed distance away from 
64   the actual ITBL. We could inline this offset as a constant into the RTS and
65   avoid the rbh_infoptr fields altogether (Jim did that in the old RTS).
66   -- HWL
67 */
68
69
70 /* function/thunk info tables --------------------------------------------- */
71
72 #if defined(GRAN) || defined(PAR)
73
74 #define \
75 INFO_TABLE_SRT(info,                            /* info-table label */  \
76                entry,                           /* entry code label */  \
77                ptrs, nptrs,                     /* closure layout info */\
78                srt_, srt_off_, srt_len_,        /* SRT info */          \
79                type,                            /* closure type */      \
80                info_class, entry_class,         /* C storage classes */ \
81                prof_descr, prof_type)           /* profiling info */    \
82         entry_class(stg_RBH_##entry);                                           \
83         entry_class(entry);                                             \
84         ED_RO_ StgInfoTable info;                                       \
85         info_class INFO_TBL_CONST StgInfoTable stg_RBH_##info = {               \
86                 layout : { payload : {ptrs,nptrs} },                    \
87                 PROF_INFO(prof_type, prof_descr)                        \
88                 SRT_INFO(RBH,srt_,srt_off_,srt_len_),                   \
89                 INCLUDE_RBH_INFO(info),                                 \
90                 INIT_ENTRY(stg_RBH_##entry),                            \
91                 INIT_VECTOR                                             \
92         } ;                                                             \
93         StgFunPtr stg_RBH_##entry (void) {                                  \
94           FB_                                                           \
95             JMP_(stg_RBH_entry);                                            \
96           FE_                                                           \
97         } ;                                                             \
98         info_class INFO_TBL_CONST StgInfoTable info = {                 \
99                 layout : { payload : {ptrs,nptrs} },                    \
100                 PROF_INFO(prof_type, prof_descr)                        \
101                 SRT_INFO(type,srt_,srt_off_,srt_len_),                  \
102                 INCLUDE_RBH_INFO(stg_RBH_##info),                               \
103                 INIT_ENTRY(entry),                                      \
104                 INIT_VECTOR                                             \
105         }
106
107 #else
108
109 #define \
110 INFO_TABLE_SRT(info,                            /* info-table label */  \
111                entry,                           /* entry code label */  \
112                ptrs, nptrs,                     /* closure layout info */\
113                srt_, srt_off_, srt_len_,        /* SRT info */          \
114                type,                            /* closure type */      \
115                info_class, entry_class,         /* C storage classes */ \
116                prof_descr, prof_type)           /* profiling info */    \
117         entry_class(entry);                                             \
118         info_class INFO_TBL_CONST StgInfoTable info = {                 \
119                 layout : { payload : {ptrs,nptrs} },                    \
120                 PROF_INFO(prof_type, prof_descr)                        \
121                 SRT_INFO(type,srt_,srt_off_,srt_len_),                  \
122                 INIT_ENTRY(entry),                                      \
123                 INIT_VECTOR                                             \
124         }
125
126 #endif
127
128 /* direct-return address info tables  --------------------------------------*/
129
130 #if defined(GRAN) || defined(PAR)
131
132 #define                                                                 \
133 INFO_TABLE_SRT_BITMAP(info, entry, bitmap_, srt_, srt_off_, srt_len_,   \
134                       type, info_class, entry_class,                    \
135                       prof_descr, prof_type)                            \
136         entry_class(stg_RBH_##entry);                                   \
137         entry_class(entry);                                             \
138         ED_RO_ StgInfoTable info;                                       \
139         info_class INFO_TBL_CONST StgInfoTable stg_RBH_##info = {       \
140                 layout : { bitmap : (StgWord)bitmap_ },                 \
141                 PROF_INFO(prof_type, prof_descr)                        \
142                 SRT_INFO(RBH,srt_,srt_off_,srt_len_),                   \
143                 INCLUDE_RBH_INFO(info),                                 \
144                 INIT_ENTRY(stg_RBH_##entry),                            \
145                 INIT_VECTOR                                             \
146         };                                                              \
147         StgFunPtr stg_RBH_##entry (void) {                              \
148           FB_                                                           \
149             JMP_(stg_RBH_entry);                                        \
150           FE_                                                           \
151         } ;                                                             \
152         info_class INFO_TBL_CONST StgInfoTable info = {                 \
153                 layout : { bitmap : (StgWord)bitmap_ },                 \
154                 PROF_INFO(prof_type, prof_descr)                        \
155                 SRT_INFO(type,srt_,srt_off_,srt_len_),                  \
156                 INCLUDE_RBH_INFO(stg_RBH_##info),                       \
157                 INIT_ENTRY(entry),                                      \
158                 INIT_VECTOR                                             \
159         }
160
161 #else
162
163 #define                                                                 \
164 INFO_TABLE_SRT_BITMAP(info, entry, bitmap_, srt_, srt_off_, srt_len_,   \
165                       type, info_class, entry_class,                    \
166                       prof_descr, prof_type)                            \
167         entry_class(entry);                                             \
168         info_class INFO_TBL_CONST StgInfoTable info = {                 \
169                 layout : { bitmap : (StgWord)bitmap_ },                 \
170                 PROF_INFO(prof_type, prof_descr)                        \
171                 SRT_INFO(type,srt_,srt_off_,srt_len_),                  \
172                 INIT_ENTRY(entry),                                      \
173                 INIT_VECTOR                                             \
174         }
175 #endif
176
177 /* info-table without an SRT -----------------------------------------------*/
178
179 #if defined(GRAN) || defined(PAR)
180
181 #define                                                         \
182 INFO_TABLE(info, entry, ptrs, nptrs, type, info_class,          \
183            entry_class, prof_descr, prof_type)                  \
184         entry_class(stg_RBH_##entry);                           \
185         entry_class(entry);                                     \
186         ED_ StgInfoTable info;                          \
187         info_class INFO_TBL_CONST StgInfoTable stg_RBH_##info = {       \
188                 layout : { payload : {ptrs,nptrs} },            \
189                 PROF_INFO(prof_type, prof_descr)                \
190                 STD_INFO(RBH),                                  \
191                 INCLUDE_RBH_INFO(info),                         \
192                 INIT_ENTRY(stg_RBH_##entry),                    \
193                 INIT_VECTOR                                     \
194         } ;                                                     \
195         StgFunPtr stg_RBH_##entry (void) {                          \
196           FB_                                                   \
197             JMP_(stg_RBH_entry);                                    \
198           FE_                                                   \
199         } ;                                                     \
200         info_class INFO_TBL_CONST StgInfoTable info = { \
201                 layout : { payload : {ptrs,nptrs} },            \
202                 PROF_INFO(prof_type, prof_descr)                \
203                 STD_INFO(type),                                 \
204                 INCLUDE_RBH_INFO(stg_RBH_##info),                       \
205                 INIT_ENTRY(entry),                              \
206                 INIT_VECTOR                                     \
207         }
208
209 #else
210
211 #define                                                 \
212 INFO_TABLE(info, entry, ptrs, nptrs, type, info_class,  \
213            entry_class, prof_descr, prof_type)          \
214         entry_class(entry);                             \
215         info_class INFO_TBL_CONST StgInfoTable info = { \
216                 layout : { payload : {ptrs,nptrs} },    \
217                 PROF_INFO(prof_type, prof_descr)        \
218                 STD_INFO(type),                         \
219                 INIT_ENTRY(entry),                      \
220                 INIT_VECTOR                             \
221         }
222
223 #endif
224
225 /* special selector-thunk info table ---------------------------------------*/
226
227 #if defined(GRAN) || defined(PAR)
228
229 #define                                                         \
230 INFO_TABLE_SELECTOR(info, entry, offset, info_class,            \
231                     entry_class, prof_descr, prof_type)         \
232         entry_class(stg_RBH_##entry);                           \
233         entry_class(entry);                                     \
234         ED_RO_ StgInfoTable info;                               \
235         info_class INFO_TBL_CONST StgInfoTable stg_RBH_##info = {       \
236                 layout : { selector_offset : offset },          \
237                 PROF_INFO(prof_type, prof_descr)                \
238                 STD_INFO(RBH),                                  \
239                 INCLUDE_RBH_INFO(info),                         \
240                 INIT_ENTRY(stg_RBH_##entry),                    \
241                 INIT_VECTOR                                     \
242         };                                                      \
243         StgFunPtr stg_RBH_##entry (void) {                          \
244           FB_                                                   \
245             JMP_(stg_RBH_entry);                                    \
246           FE_                                                   \
247         } ;                                                     \
248         info_class INFO_TBL_CONST StgInfoTable info = {         \
249                 layout : { selector_offset : offset },          \
250                 PROF_INFO(prof_type, prof_descr)                \
251                 STD_INFO(THUNK_SELECTOR),                       \
252                 INCLUDE_RBH_INFO(stg_RBH_##info),                       \
253                 INIT_ENTRY(entry),                              \
254                 INIT_VECTOR                                     \
255         }
256
257 #else
258
259 #define                                                 \
260 INFO_TABLE_SELECTOR(info, entry, offset, info_class,    \
261                     entry_class, prof_descr, prof_type) \
262         entry_class(entry);                             \
263         info_class INFO_TBL_CONST StgInfoTable info = { \
264                 layout : { selector_offset : offset },  \
265                 PROF_INFO(prof_type, prof_descr)        \
266                 STD_INFO(THUNK_SELECTOR),               \
267                 INIT_ENTRY(entry),                      \
268                 INIT_VECTOR                             \
269         }
270
271 #endif
272
273 /* constructor info table --------------------------------------------------*/
274
275 #define                                                                 \
276 INFO_TABLE_CONSTR(info, entry, ptrs, nptrs, tag_,type_,info_class,      \
277                   entry_class, prof_descr, prof_type)                   \
278         entry_class(entry);                                             \
279         info_class INFO_TBL_CONST StgInfoTable info = {                 \
280                 layout : { payload : {ptrs,nptrs} },                    \
281                 PROF_INFO(prof_type, prof_descr)                        \
282                 CONSTR_INFO(type_,tag_),                                \
283                 INIT_ENTRY(entry),                                      \
284                 INIT_VECTOR                                             \
285         }
286
287 #define constrTag(con) (get_itbl(con)->srt_len)
288
289 /* return-vectors ----------------------------------------------------------*/
290
291 /* vectored-return info tables have the vector slammed up against the
292  * start of the info table.
293  *
294  * A vectored-return address always has an SRT and a bitmap-style
295  * layout field, so we only need one macro for these.
296  */
297
298 #ifdef TABLES_NEXT_TO_CODE
299
300 typedef struct {
301   StgFunPtr vec[2];
302   StgInfoTable i;
303 } vec_info_2;
304
305 typedef struct {
306   StgFunPtr vec[3];
307   StgInfoTable i;
308 } vec_info_3;
309
310 typedef struct {
311   StgFunPtr vec[4];
312   StgInfoTable i;
313 } vec_info_4;
314
315 typedef struct {
316   StgFunPtr vec[5];
317   StgInfoTable i;
318 } vec_info_5;
319
320 typedef struct {
321   StgFunPtr vec[6];
322   StgInfoTable i;
323 } vec_info_6;
324
325 typedef struct {
326   StgFunPtr vec[7];
327   StgInfoTable i;
328 } vec_info_7;
329
330 typedef struct {
331   StgFunPtr vec[8];
332   StgInfoTable i;
333 } vec_info_8;
334
335 #define VEC_INFO_2(info,bitmap_,srt_,srt_off_,srt_len_,         \
336                    type, info_class,                            \
337                    alt_1, alt_2)                                \
338         info_class INFO_TBL_CONST vec_info_2 info = {           \
339                 { alt_2, alt_1 },                               \
340                 i : {                                           \
341                    layout : { bitmap : (StgWord)bitmap_ },      \
342                    SRT_INFO(type,srt_,srt_off_,srt_len_)        \
343                 }                                               \
344         }
345
346 #define VEC_INFO_3(info,bitmap_,srt_,srt_off_,srt_len_,         \
347                    type, info_class,                            \
348                    alt_1, alt_2, alt_3                          \
349                   )                                             \
350         info_class INFO_TBL_CONST vec_info_3 info = {           \
351                 { alt_3, alt_2, alt_1 },                        \
352                 i : {                                           \
353                    layout : { bitmap : (StgWord)bitmap_ },      \
354                    SRT_INFO(type,srt_,srt_off_,srt_len_)        \
355                 }                                               \
356         }
357
358 #define VEC_INFO_4(info,bitmap_,srt_,srt_off_,srt_len_,         \
359                    type, info_class,                            \
360                    alt_1, alt_2, alt_3, alt_4                   \
361                   )                                             \
362         info_class INFO_TBL_CONST vec_info_4 info = {           \
363                 { alt_4, alt_3, alt_2, alt_1 },                 \
364                 i : {                                           \
365                    layout : { bitmap : (StgWord)bitmap_ },      \
366                    SRT_INFO(type,srt_,srt_off_,srt_len_)        \
367                 }                                               \
368         }
369
370 #define VEC_INFO_5(info,bitmap_,srt_,srt_off_,srt_len_,         \
371                    type, info_class,                            \
372                    alt_1, alt_2, alt_3, alt_4,                  \
373                    alt_5                                        \
374                   )                                             \
375         info_class INFO_TBL_CONST vec_info_5 info = {           \
376                 { alt_5, alt_4, alt_3, alt_2,                   \
377                   alt_1 },                                      \
378                 i : {                                           \
379                    layout : { bitmap : (StgWord)bitmap_ },      \
380                    SRT_INFO(type,srt_,srt_off_,srt_len_)        \
381                 }                                               \
382         }
383
384 #define VEC_INFO_6(info,bitmap_,srt_,srt_off_,srt_len_,         \
385                    type, info_class,                            \
386                    alt_1, alt_2, alt_3, alt_4,                  \
387                    alt_5, alt_6                                 \
388                   )                                             \
389         info_class INFO_TBL_CONST vec_info_6 info = {           \
390                 { alt_6, alt_5, alt_4, alt_3,                   \
391                   alt_2, alt_1 },                               \
392                 i : {                                           \
393                    layout : { bitmap : (StgWord)bitmap_ },      \
394                    SRT_INFO(type,srt_,srt_off_,srt_len_)        \
395                 }                                               \
396         }
397
398 #define VEC_INFO_7(info,bitmap_,srt_,srt_off_,srt_len_,         \
399                    type, info_class,                            \
400                    alt_1, alt_2, alt_3, alt_4,                  \
401                    alt_5, alt_6, alt_7                          \
402                   )                                             \
403         info_class INFO_TBL_CONST vec_info_7 info = {           \
404                 { alt_7, alt_6, alt_5, alt_4,                   \
405                   alt_3, alt_2, alt_1 },                        \
406                 i : {                                           \
407                    layout : { bitmap : (StgWord)bitmap_ },      \
408                    SRT_INFO(type,srt_,srt_off_,srt_len_)        \
409                 }                                               \
410         }
411
412 #define VEC_INFO_8(info,bitmap_,srt_,srt_off_,srt_len_,         \
413                    type, info_class,                            \
414                    alt_1, alt_2, alt_3, alt_4,                  \
415                    alt_5, alt_6, alt_7, alt_8                   \
416                   )                                             \
417         info_class INFO_TBL_CONST vec_info_8 info = {           \
418                 { alt_8, alt_7, alt_6, alt_5,                   \
419                   alt_4, alt_3, alt_2, alt_1 },                 \
420                 i : {                                           \
421                    layout : { bitmap : (StgWord)bitmap_ },      \
422                    SRT_INFO(type,srt_,srt_off_,srt_len_)        \
423                 }                                               \
424         }
425
426
427 #else
428
429 /* We have to define these structure to work around a bug in gcc: if we
430  * try to initialise the vector directly (it's defined as a zero-length
431  * array tacked on the end of the info table structor), then gcc silently
432  * throws away our vector table sometimes.
433  */
434
435 typedef struct {
436   StgInfoTable i;
437   StgFunPtr vec[2];
438 } vec_info_2;
439
440 typedef struct {
441   StgInfoTable i;
442   StgFunPtr vec[3];
443 } vec_info_3;
444
445 typedef struct {
446   StgInfoTable i;
447   StgFunPtr vec[4];
448 } vec_info_4;
449
450 typedef struct {
451   StgInfoTable i;
452   StgFunPtr vec[5];
453 } vec_info_5;
454
455 typedef struct {
456   StgInfoTable i;
457   StgFunPtr vec[6];
458 } vec_info_6;
459
460 typedef struct {
461   StgInfoTable i;
462   StgFunPtr vec[7];
463 } vec_info_7;
464
465 typedef struct {
466   StgInfoTable i;
467   StgFunPtr vec[8];
468 } vec_info_8;
469
470 #define VEC_INFO_2(info,bitmap_,srt_,srt_off_,srt_len_,         \
471                    type, info_class,                            \
472                    alt_1, alt_2)                                \
473         info_class INFO_TBL_CONST vec_info_2 info = {           \
474                 i : { layout : { bitmap : (StgWord)bitmap_ },   \
475                       SRT_INFO(type,srt_,srt_off_,srt_len_),    \
476                       INIT_ENTRY(NULL),                         \
477                 },                                              \
478                 vec : { alt_1, alt_2 }                          \
479         }
480
481 #define VEC_INFO_3(info,bitmap_,srt_,srt_off_,srt_len_,         \
482                    type, info_class,                            \
483                    alt_1, alt_2, alt_3                          \
484                   )                                             \
485         info_class INFO_TBL_CONST vec_info_3 info = {           \
486                 i : { layout : { bitmap : (StgWord)bitmap_ },   \
487                       SRT_INFO(type,srt_,srt_off_,srt_len_),    \
488                       INIT_ENTRY(NULL),                         \
489                 },                                              \
490                 vec : { alt_1, alt_2, alt_3 }                   \
491         }
492
493 #define VEC_INFO_4(info,bitmap_,srt_,srt_off_,srt_len_,         \
494                    type, info_class,                            \
495                    alt_1, alt_2, alt_3, alt_4                   \
496                   )                                             \
497         info_class INFO_TBL_CONST vec_info_4 info = {           \
498                 i : { layout : { bitmap : (StgWord)bitmap_ },   \
499                       SRT_INFO(type,srt_,srt_off_,srt_len_),    \
500                       INIT_ENTRY(NULL),                         \
501                 },                                              \
502                 vec : { alt_1, alt_2, alt_3, alt_4 }            \
503         }
504
505 #define VEC_INFO_5(info,bitmap_,srt_,srt_off_,srt_len_,         \
506                    type, info_class,                            \
507                    alt_1, alt_2, alt_3, alt_4,                  \
508                    alt_5                                        \
509                   )                                             \
510         info_class INFO_TBL_CONST vec_info_5 info = {           \
511                 i : { layout : { bitmap : (StgWord)bitmap_ },   \
512                       SRT_INFO(type,srt_,srt_off_,srt_len_),    \
513                       INIT_ENTRY(NULL),                         \
514                 },                                              \
515                 vec : { alt_1, alt_2, alt_3, alt_4,             \
516                         alt_5 }                                 \
517         }
518
519 #define VEC_INFO_6(info,bitmap_,srt_,srt_off_,srt_len_,         \
520                    type, info_class,                            \
521                    alt_1, alt_2, alt_3, alt_4,                  \
522                    alt_5, alt_6                                 \
523                   )                                             \
524         info_class INFO_TBL_CONST vec_info_6 info = {           \
525                 i : { layout : { bitmap : (StgWord)bitmap_ },   \
526                       SRT_INFO(type,srt_,srt_off_,srt_len_),    \
527                       INIT_ENTRY(NULL),                         \
528                 },                                              \
529                 vec : { alt_1, alt_2, alt_3, alt_4,             \
530                         alt_5, alt_6 }                          \
531         }
532
533 #define VEC_INFO_7(info,bitmap_,srt_,srt_off_,srt_len_,         \
534                    type, info_class,                            \
535                    alt_1, alt_2, alt_3, alt_4,                  \
536                    alt_5, alt_6, alt_7                          \
537                   )                                             \
538         info_class INFO_TBL_CONST vec_info_7 info = {           \
539                 i : { layout : { bitmap : (StgWord)bitmap_ },   \
540                       SRT_INFO(type,srt_,srt_off_,srt_len_),    \
541                       INIT_ENTRY(NULL),                         \
542                 },                                              \
543                 vec : { alt_1, alt_2, alt_3, alt_4,             \
544                         alt_5, alt_6, alt_7 }                   \
545         }
546
547 #define VEC_INFO_8(info,bitmap_,srt_,srt_off_,srt_len_,         \
548                    type, info_class,                            \
549                    alt_1, alt_2, alt_3, alt_4,                  \
550                    alt_5, alt_6, alt_7, alt_8                   \
551                   )                                             \
552         info_class INFO_TBL_CONST vec_info_8 info = {           \
553                 i : { layout : { bitmap : (StgWord)bitmap_ },   \
554                       SRT_INFO(type,srt_,srt_off_,srt_len_),    \
555                       INIT_ENTRY(NULL),                         \
556                 },                                              \
557                 vec : { alt_1, alt_2, alt_3, alt_4,             \
558                         alt_5, alt_6, alt_7, alt_8 }            \
559         }
560
561 #endif /* TABLES_NEXT_TO_CODE */
562
563 /* For polymorphic activation records, we need both a direct return
564  * address and a return vector:
565  */
566
567 typedef vec_info_8 StgPolyInfoTable;
568
569 #ifndef TABLES_NEXT_TO_CODE
570
571 #define VEC_POLY_INFO_TABLE(nm, bitmap_,                        \
572                            srt_, srt_off_, srt_len_,            \
573                            type, info_class, entry_class        \
574                            )                                    \
575   info_class INFO_TBL_CONST vec_info_8 nm##_info = {            \
576                 i : { layout : { bitmap : (StgWord)bitmap_ },   \
577                       SRT_INFO(type,srt_,srt_off_,srt_len_),    \
578                       INIT_ENTRY(nm##_entry),                   \
579                       INIT_VECTOR                               \
580                 },                                              \
581                 vec : {                                         \
582                         (F_) nm##_0_entry,                      \
583                         (F_) nm##_1_entry,                      \
584                         (F_) nm##_2_entry,                      \
585                         (F_) nm##_3_entry,                      \
586                         (F_) nm##_4_entry,                      \
587                         (F_) nm##_5_entry,                      \
588                         (F_) nm##_6_entry,                      \
589                         (F_) nm##_7_entry                       \
590                 }                                               \
591             }
592 #else
593
594 #define VEC_POLY_INFO_TABLE(nm, bitmap_,                        \
595                            srt_, srt_off_, srt_len_,            \
596                            type, info_class, entry_class        \
597                            )                                    \
598         info_class INFO_TBL_CONST vec_info_8 nm##_info = {      \
599                 {                                               \
600                         (F_) nm##_7_entry,                      \
601                         (F_) nm##_6_entry,                      \
602                         (F_) nm##_5_entry,                      \
603                         (F_) nm##_4_entry,                      \
604                         (F_) nm##_3_entry,                      \
605                         (F_) nm##_2_entry,                      \
606                         (F_) nm##_1_entry,                      \
607                         (F_) nm##_0_entry                       \
608                 },                                              \
609                 i : {                                           \
610                    layout : { bitmap : (StgWord)bitmap_ },      \
611                    SRT_INFO(type,srt_,srt_off_,srt_len_),       \
612                    INIT_ENTRY(nm##_entry)                       \
613                 }                                               \
614         }
615
616 #endif
617
618 #define SRT(lbl) \
619   static const StgSRT lbl = {
620
621 #define BITMAP(lbl,size,contents) \
622   static const StgLargeBitmap lbl = { \
623       (size*4+SIZEOF_VOID_P-1)/SIZEOF_VOID_P, { contents } };
624
625 #if SIZEOF_VOID_P == 8
626 #define BITMAP_SWITCH64(small, large)   small
627 #define BITMAP64(first, second)         \
628   (((StgWord32)(first)) | ((StgWord)(StgWord32)(second) << 32))
629 #else
630 #define BITMAP_SWITCH64(small, large)   large
631 #define BITMAP64(first, second)         first, second
632 #endif
633 #define BITMAP32(x)                     ((StgWord32)(x))
634 #define COMMA                           ,
635
636 /* DLL_SRT_ENTRY is used on the Win32 side when filling initialising
637    an entry in an SRT table with a reference to a closure that's
638    living in a DLL. See elsewhere for reasons as to why we need
639    to distinguish these kinds of references.
640    (ToDo: fill in a more precise href.)
641 */
642 #ifdef ENABLE_WIN32_DLL_SUPPORT /* mingw DietHEP doesn't seem to care either way */
643 #define DLL_SRT_ENTRY(x) ((StgClosure*)(((char*)&DLL_IMPORT_DATA_VAR(x)) + 1))
644 #else
645 #define DLL_SRT_ENTRY(x) no-can-do
646 #endif
647
648 #endif /* INFOMACROS_H */