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