[project @ 2002-06-03 11:31:55 by simonmar]
[ghc-hetmet.git] / ghc / includes / InfoMacros.h
index 80e9611..b181ce5 100644 (file)
@@ -1,5 +1,5 @@
 /* ----------------------------------------------------------------------------
- * $Id: InfoMacros.h,v 1.14 2001/03/22 03:51:09 hwloidl Exp $
+ * $Id: InfoMacros.h,v 1.18 2002/02/26 05:03:27 sof Exp $
  * 
  * (c) The GHC Team, 1998-1999
  *
@@ -35,8 +35,9 @@
 #define PROF_INFO(type_str, desc_str)
 #endif
 
+/* Why no empty array initializer in the 'else' branch? sof 2/02 */
 #ifdef USE_MINIINTERPRETER
-#define INIT_VECTOR {}
+#define INIT_VECTOR vector : {}
 #else
 #define INIT_VECTOR
 #endif
@@ -135,24 +136,24 @@ INFO_TABLE_SRT_BITMAP(info, entry, bitmap_, srt_, srt_off_, srt_len_,     \
         entry_class(stg_RBH_##entry);                                  \
         entry_class(entry);                                            \
        ED_RO_ StgInfoTable info;                                       \
-       info_class INFO_TBL_CONST StgInfoTable stg_RBH_##info = {               \
-               layout : { bitmap : (StgWord32)bitmap_ },               \
+       info_class INFO_TBL_CONST StgInfoTable stg_RBH_##info = {       \
+               layout : { bitmap : (StgWord)bitmap_ },                 \
                 PROF_INFO(prof_type, prof_descr)                       \
                SRT_INFO(RBH,srt_,srt_off_,srt_len_),                   \
                 INCLUDE_RBH_INFO(info),                                        \
                 INIT_ENTRY(stg_RBH_##entry),                           \
                 INIT_VECTOR                                            \
        };                                                              \
-        StgFunPtr stg_RBH_##entry (void) {                                  \
+        StgFunPtr stg_RBH_##entry (void) {                              \
           FB_                                                           \
-            JMP_(stg_RBH_entry);                                            \
+            JMP_(stg_RBH_entry);                                        \
           FE_                                                           \
         } ;                                                             \
        info_class INFO_TBL_CONST StgInfoTable info = {                 \
-               layout : { bitmap : (StgWord32)bitmap_ },               \
+               layout : { bitmap : (StgWord)bitmap_ },                 \
                 PROF_INFO(prof_type, prof_descr)                       \
                SRT_INFO(type,srt_,srt_off_,srt_len_),                  \
-                INCLUDE_RBH_INFO(stg_RBH_##info),                              \
+                INCLUDE_RBH_INFO(stg_RBH_##info),                      \
                 INIT_ENTRY(entry),                                     \
                 INIT_VECTOR                                            \
        }
@@ -165,7 +166,7 @@ INFO_TABLE_SRT_BITMAP(info, entry, bitmap_, srt_, srt_off_, srt_len_,       \
                      prof_descr, prof_type)                            \
         entry_class(entry);                                            \
        info_class INFO_TBL_CONST StgInfoTable info = {                 \
-               layout : { bitmap : (StgWord32)bitmap_ },               \
+               layout : { bitmap : (StgWord)bitmap_ },                 \
                 PROF_INFO(prof_type, prof_descr)                       \
                SRT_INFO(type,srt_,srt_off_,srt_len_),                  \
                 INIT_ENTRY(entry),                                     \
@@ -337,7 +338,7 @@ typedef struct {
        info_class INFO_TBL_CONST vec_info_2 info = {           \
                { alt_2, alt_1 },                               \
                i : {                                           \
-                  layout : { bitmap : (StgWord32)bitmap_ },    \
+                  layout : { bitmap : (StgWord)bitmap_ },      \
                   SRT_INFO(type,srt_,srt_off_,srt_len_)        \
                }                                               \
        }
@@ -349,7 +350,7 @@ typedef struct {
        info_class INFO_TBL_CONST vec_info_3 info = {           \
                { alt_3, alt_2, alt_1 },                        \
                i : {                                           \
-                  layout : { bitmap : (StgWord32)bitmap_ },    \
+                  layout : { bitmap : (StgWord)bitmap_ },      \
                   SRT_INFO(type,srt_,srt_off_,srt_len_)        \
                }                                               \
        }
@@ -361,7 +362,7 @@ typedef struct {
        info_class INFO_TBL_CONST vec_info_4 info = {           \
                { alt_4, alt_3, alt_2, alt_1 },                 \
                i : {                                           \
-                  layout : { bitmap : (StgWord32)bitmap_ },    \
+                  layout : { bitmap : (StgWord)bitmap_ },      \
                   SRT_INFO(type,srt_,srt_off_,srt_len_)        \
                }                                               \
        }
@@ -375,7 +376,7 @@ typedef struct {
                { alt_5, alt_4, alt_3, alt_2,                   \
                  alt_1 },                                      \
                i : {                                           \
-                  layout : { bitmap : (StgWord32)bitmap_ },    \
+                  layout : { bitmap : (StgWord)bitmap_ },      \
                   SRT_INFO(type,srt_,srt_off_,srt_len_)        \
                }                                               \
        }
@@ -389,7 +390,7 @@ typedef struct {
                { alt_6, alt_5, alt_4, alt_3,                   \
                  alt_2, alt_1 },                               \
                i : {                                           \
-                  layout : { bitmap : (StgWord32)bitmap_ },    \
+                  layout : { bitmap : (StgWord)bitmap_ },      \
                   SRT_INFO(type,srt_,srt_off_,srt_len_)        \
                }                                               \
        }
@@ -403,7 +404,7 @@ typedef struct {
                { alt_7, alt_6, alt_5, alt_4,                   \
                  alt_3, alt_2, alt_1 },                        \
                i : {                                           \
-                  layout : { bitmap : (StgWord32)bitmap_ },    \
+                  layout : { bitmap : (StgWord)bitmap_ },      \
                   SRT_INFO(type,srt_,srt_off_,srt_len_)        \
                }                                               \
        }
@@ -417,7 +418,7 @@ typedef struct {
                { alt_8, alt_7, alt_6, alt_5,                   \
                  alt_4, alt_3, alt_2, alt_1 },                 \
                i : {                                           \
-                  layout : { bitmap : (StgWord32)bitmap_ },    \
+                  layout : { bitmap : (StgWord)bitmap_ },      \
                   SRT_INFO(type,srt_,srt_off_,srt_len_)        \
                }                                               \
        }
@@ -470,7 +471,7 @@ typedef struct {
                   type, info_class,                            \
                   alt_1, alt_2)                                \
        info_class INFO_TBL_CONST vec_info_2 info = {           \
-               i : { layout : { bitmap : (StgWord32)bitmap_ }, \
+               i : { layout : { bitmap : (StgWord)bitmap_ },   \
                      SRT_INFO(type,srt_,srt_off_,srt_len_),    \
                      INIT_ENTRY(NULL),                         \
                },                                              \
@@ -482,7 +483,7 @@ typedef struct {
                   alt_1, alt_2, alt_3                          \
                  )                                             \
        info_class INFO_TBL_CONST vec_info_3 info = {           \
-               i : { layout : { bitmap : (StgWord32)bitmap_ }, \
+               i : { layout : { bitmap : (StgWord)bitmap_ },   \
                      SRT_INFO(type,srt_,srt_off_,srt_len_),    \
                      INIT_ENTRY(NULL),                         \
                },                                              \
@@ -494,7 +495,7 @@ typedef struct {
                   alt_1, alt_2, alt_3, alt_4                   \
                  )                                             \
        info_class INFO_TBL_CONST vec_info_4 info = {           \
-               i : { layout : { bitmap : (StgWord32)bitmap_ }, \
+               i : { layout : { bitmap : (StgWord)bitmap_ },   \
                      SRT_INFO(type,srt_,srt_off_,srt_len_),    \
                      INIT_ENTRY(NULL),                         \
                },                                              \
@@ -507,7 +508,7 @@ typedef struct {
                   alt_5                                        \
                  )                                             \
        info_class INFO_TBL_CONST vec_info_5 info = {           \
-               i : { layout : { bitmap : (StgWord32)bitmap_ }, \
+               i : { layout : { bitmap : (StgWord)bitmap_ },   \
                      SRT_INFO(type,srt_,srt_off_,srt_len_),    \
                      INIT_ENTRY(NULL),                         \
                },                                              \
@@ -521,7 +522,7 @@ typedef struct {
                   alt_5, alt_6                                 \
                  )                                             \
        info_class INFO_TBL_CONST vec_info_6 info = {           \
-               i : { layout : { bitmap : (StgWord32)bitmap_ }, \
+               i : { layout : { bitmap : (StgWord)bitmap_ },   \
                      SRT_INFO(type,srt_,srt_off_,srt_len_),    \
                      INIT_ENTRY(NULL),                         \
                },                                              \
@@ -535,7 +536,7 @@ typedef struct {
                   alt_5, alt_6, alt_7                          \
                  )                                             \
        info_class INFO_TBL_CONST vec_info_7 info = {           \
-               i : { layout : { bitmap : (StgWord32)bitmap_ }, \
+               i : { layout : { bitmap : (StgWord)bitmap_ },   \
                      SRT_INFO(type,srt_,srt_off_,srt_len_),    \
                      INIT_ENTRY(NULL),                         \
                },                                              \
@@ -549,7 +550,7 @@ typedef struct {
                   alt_5, alt_6, alt_7, alt_8                   \
                  )                                             \
        info_class INFO_TBL_CONST vec_info_8 info = {           \
-               i : { layout : { bitmap : (StgWord32)bitmap_ }, \
+               i : { layout : { bitmap : (StgWord)bitmap_ },   \
                      SRT_INFO(type,srt_,srt_off_,srt_len_),    \
                      INIT_ENTRY(NULL),                         \
                },                                              \
@@ -572,7 +573,7 @@ typedef vec_info_8 StgPolyInfoTable;
                           type, info_class, entry_class        \
                           )                                    \
   info_class INFO_TBL_CONST vec_info_8 nm##_info = {           \
-               i : { layout : { bitmap : (StgWord32)bitmap_ }, \
+               i : { layout : { bitmap : (StgWord)bitmap_ },   \
                      SRT_INFO(type,srt_,srt_off_,srt_len_),    \
                       INIT_ENTRY(nm##_entry),                  \
                      INIT_VECTOR                               \
@@ -606,7 +607,7 @@ typedef vec_info_8 StgPolyInfoTable;
                        (F_) nm##_0_entry                       \
                },                                              \
                i : {                                           \
-                  layout : { bitmap : (StgWord32)bitmap_ },    \
+                  layout : { bitmap : (StgWord)bitmap_ },      \
                   SRT_INFO(type,srt_,srt_off_,srt_len_),       \
                    INIT_ENTRY(nm##_entry)                      \
                }                                               \
@@ -617,8 +618,20 @@ typedef vec_info_8 StgPolyInfoTable;
 #define SRT(lbl) \
   static const StgSRT lbl = {
 
-#define BITMAP(lbl,size) \
-  static const StgLargeBitmap lbl = { size, {
+#define BITMAP(lbl,size,contents) \
+  static const StgLargeBitmap lbl = { \
+      (size*4+SIZEOF_VOID_P-1)/SIZEOF_VOID_P, { contents } };
+
+#if SIZEOF_VOID_P == 8
+#define BITMAP_SWITCH64(small, large)  small
+#define BITMAP64(first, second)                \
+  (((StgWord32)(first)) | ((StgWord)(StgWord32)(second) << 32))
+#else
+#define BITMAP_SWITCH64(small, large)  large
+#define BITMAP64(first, second)                first, second
+#endif
+#define BITMAP32(x)                    ((StgWord32)(x))
+#define COMMA                          ,
 
 /* DLL_SRT_ENTRY is used on the Win32 side when filling initialising
    an entry in an SRT table with a reference to a closure that's