/* ----------------------------------------------------------------------------
- * $Id: InfoMacros.h,v 1.6 1999/05/13 17:31:06 simonm Exp $
+ * $Id: InfoMacros.h,v 1.11 2000/04/05 15:27:59 simonmar Exp $
*
* (c) The GHC Team, 1998-1999
*
srt_len : srt_len_, \
type : type_
+#define CONSTR_INFO(type_,tag_) \
+ srt : 0, \
+ srt_len : tag_, \
+ type : type_
+
+#ifdef PROFILING
+#define PROF_INFO(type_str, desc_str) \
+ prof: { \
+ closure_type: type_str, \
+ closure_desc: desc_str, \
+ },
+#else
+#define PROF_INFO(type_str, desc_str)
+#endif
+
#ifdef USE_MINIINTERPRETER
#define INIT_VECTOR {}
#else
#define INIT_VECTOR
#endif
+/*
+ On the GranSim/GUM specific parts of the InfoTables (GRAN/PAR):
+
+ In both GranSim and GUM we use revertible black holes (RBH) when putting
+ an updatable closure into a packet for communication. The entry code for
+ an RBH performs standard blocking (as with any kind of BH). The info
+ table for the RBH resides just before the one for the std info
+ table. (NB: there is one RBH ITBL for every ITBL of an updatable
+ closure.) The @rbh_infoptr@ field in the ITBL points from the std ITBL to
+ the RBH ITBL and vice versa. This is used by the RBH_INFOPTR and
+ REVERT_INFOPTR macros to turn an updatable node into an RBH and vice
+ versa. Note, that the only case where we have to revert the RBH in its
+ original form is when a packet is sent back because of garbage collection
+ on another PE. In the RTS for GdH we will use this reversion mechanism in
+ order to deal with faults in the system.
+ ToDo: Check that RBHs are needed for all the info tables below. From a quick
+ check of the macros generated in the libs it seems that all of them are used
+ for generating THUNKs.
+ Possible optimisation: Note that any RBH ITBL is a fixed distance away from
+ the actual ITBL. We could inline this offset as a constant into the RTS and
+ avoid the rbh_infoptr fields altogether (Jim did that in the old RTS).
+ -- HWL
+*/
+
+
/* function/thunk info tables --------------------------------------------- */
+#if defined(GRAN) || defined(PAR)
+
+#define \
+INFO_TABLE_SRT(info, /* info-table label */ \
+ entry, /* entry code label */ \
+ ptrs, nptrs, /* closure layout info */\
+ srt_, srt_off_, srt_len_, /* SRT info */ \
+ type, /* closure type */ \
+ info_class, entry_class, /* C storage classes */ \
+ prof_descr, prof_type) /* profiling info */ \
+ entry_class(RBH_##entry); \
+ entry_class(entry); \
+ ED_RO_ StgInfoTable info; \
+ info_class INFO_TBL_CONST StgInfoTable RBH_##info = { \
+ layout : { payload : {ptrs,nptrs} }, \
+ PROF_INFO(prof_type, prof_descr) \
+ SRT_INFO(RBH,srt_,srt_off_,srt_len_), \
+ INCLUDE_RBH_INFO(info), \
+ INIT_ENTRY(RBH_##entry), \
+ INIT_VECTOR \
+ } ; \
+ StgFunPtr RBH_##entry (void) { JMP_(RBH_entry); } ; \
+ info_class INFO_TBL_CONST StgInfoTable info = { \
+ layout : { payload : {ptrs,nptrs} }, \
+ PROF_INFO(prof_type, prof_descr) \
+ SRT_INFO(type,srt_,srt_off_,srt_len_), \
+ INCLUDE_RBH_INFO(RBH_##info), \
+ INIT_ENTRY(entry), \
+ INIT_VECTOR \
+ }
+
+#else
+
#define \
INFO_TABLE_SRT(info, /* info-table label */ \
entry, /* entry code label */ \
entry_class(entry); \
info_class INFO_TBL_CONST StgInfoTable info = { \
layout : { payload : {ptrs,nptrs} }, \
+ PROF_INFO(prof_type, prof_descr) \
SRT_INFO(type,srt_,srt_off_,srt_len_), \
INIT_ENTRY(entry), \
INIT_VECTOR \
}
+#endif
/* direct-return address info tables --------------------------------------*/
+#if defined(GRAN) || defined(PAR)
+
+#define \
+INFO_TABLE_SRT_BITMAP(info, entry, bitmap_, srt_, srt_off_, srt_len_, \
+ type, info_class, entry_class, \
+ prof_descr, prof_type) \
+ entry_class(RBH_##entry); \
+ entry_class(entry); \
+ ED_RO_ StgInfoTable info; \
+ info_class INFO_TBL_CONST StgInfoTable RBH_##info = { \
+ layout : { bitmap : (StgWord32)bitmap_ }, \
+ PROF_INFO(prof_type, prof_descr) \
+ SRT_INFO(RBH,srt_,srt_off_,srt_len_), \
+ INCLUDE_RBH_INFO(info), \
+ INIT_ENTRY(RBH_##entry), \
+ INIT_VECTOR \
+ }; \
+ StgFunPtr RBH_##entry (void) { JMP_(RBH_entry); } ; \
+ info_class INFO_TBL_CONST StgInfoTable info = { \
+ layout : { bitmap : (StgWord32)bitmap_ }, \
+ PROF_INFO(prof_type, prof_descr) \
+ SRT_INFO(type,srt_,srt_off_,srt_len_), \
+ INCLUDE_RBH_INFO(RBH_##info), \
+ INIT_ENTRY(entry), \
+ INIT_VECTOR \
+ }
+#else
+
#define \
INFO_TABLE_SRT_BITMAP(info, entry, bitmap_, srt_, srt_off_, srt_len_, \
type, info_class, entry_class, \
entry_class(entry); \
info_class INFO_TBL_CONST StgInfoTable info = { \
layout : { bitmap : (StgWord32)bitmap_ }, \
+ PROF_INFO(prof_type, prof_descr) \
SRT_INFO(type,srt_,srt_off_,srt_len_), \
INIT_ENTRY(entry), \
INIT_VECTOR \
}
+#endif
/* info-table without an SRT -----------------------------------------------*/
+#if defined(GRAN) || defined(PAR)
+
+#define \
+INFO_TABLE(info, entry, ptrs, nptrs, type, info_class, \
+ entry_class, prof_descr, prof_type) \
+ entry_class(RBH_##entry); \
+ entry_class(entry); \
+ ED_RO_ StgInfoTable info; \
+ info_class INFO_TBL_CONST StgInfoTable RBH_##info = { \
+ layout : { payload : {ptrs,nptrs} }, \
+ PROF_INFO(prof_type, prof_descr) \
+ STD_INFO(RBH), \
+ INCLUDE_RBH_INFO(info), \
+ INIT_ENTRY(RBH_##entry), \
+ INIT_VECTOR \
+ }; \
+ StgFunPtr RBH_##entry (void) { JMP_(RBH_entry); } ; \
+ info_class INFO_TBL_CONST StgInfoTable info = { \
+ layout : { payload : {ptrs,nptrs} }, \
+ PROF_INFO(prof_type, prof_descr) \
+ STD_INFO(type), \
+ INCLUDE_RBH_INFO(RBH_##info), \
+ INIT_ENTRY(entry), \
+ INIT_VECTOR \
+ }
+
+#else
+
#define \
INFO_TABLE(info, entry, ptrs, nptrs, type, info_class, \
entry_class, prof_descr, prof_type) \
entry_class(entry); \
info_class INFO_TBL_CONST StgInfoTable info = { \
layout : { payload : {ptrs,nptrs} }, \
+ PROF_INFO(prof_type, prof_descr) \
STD_INFO(type), \
INIT_ENTRY(entry), \
INIT_VECTOR \
}
+#endif
+
/* special selector-thunk info table ---------------------------------------*/
+#if defined(GRAN) || defined(PAR)
+
+#define \
+INFO_TABLE_SELECTOR(info, entry, offset, info_class, \
+ entry_class, prof_descr, prof_type) \
+ entry_class(RBH_##entry); \
+ entry_class(entry); \
+ ED_RO_ StgInfoTable info; \
+ info_class INFO_TBL_CONST StgInfoTable RBH_##info = { \
+ layout : { selector_offset : offset }, \
+ PROF_INFO(prof_type, prof_descr) \
+ STD_INFO(RBH), \
+ INCLUDE_RBH_INFO(info), \
+ INIT_ENTRY(RBH_##entry), \
+ INIT_VECTOR \
+ }; \
+ StgFunPtr RBH_##entry (void) { JMP_(RBH_entry); } ; \
+ info_class INFO_TBL_CONST StgInfoTable info = { \
+ layout : { selector_offset : offset }, \
+ PROF_INFO(prof_type, prof_descr) \
+ STD_INFO(THUNK_SELECTOR), \
+ INCLUDE_RBH_INFO(RBH_##info), \
+ INIT_ENTRY(entry), \
+ INIT_VECTOR \
+ }
+
+#else
+
#define \
INFO_TABLE_SELECTOR(info, entry, offset, info_class, \
entry_class, prof_descr, prof_type) \
entry_class(entry); \
info_class INFO_TBL_CONST StgInfoTable info = { \
layout : { selector_offset : offset }, \
+ PROF_INFO(prof_type, prof_descr) \
STD_INFO(THUNK_SELECTOR), \
INIT_ENTRY(entry), \
INIT_VECTOR \
}
+#endif
+
/* constructor info table --------------------------------------------------*/
-#define \
+#define \
INFO_TABLE_CONSTR(info, entry, ptrs, nptrs, tag_,type_,info_class, \
entry_class, prof_descr, prof_type) \
entry_class(entry); \
info_class INFO_TBL_CONST StgInfoTable info = { \
layout : { payload : {ptrs,nptrs} }, \
- srt_len : tag_, \
- type : type_, \
+ PROF_INFO(prof_type, prof_descr) \
+ CONSTR_INFO(type_,tag_), \
INIT_ENTRY(entry), \
INIT_VECTOR \
}
* layout field, so we only need one macro for these.
*/
-#ifndef USE_MINIINTERPRETER
+#ifdef TABLES_NEXT_TO_CODE
typedef struct {
StgFunPtr vec[2];
alt_5, alt_6, alt_7, alt_8 } \
}
-#endif /* MINI_INTERPRETER */
+#endif /* TABLES_NEXT_TO_CODE */
/* For polymorphic activation records, we need both a direct return
* address and a return vector:
typedef vec_info_8 StgPolyInfoTable;
-#ifdef USE_MINIINTERPRETER
+#ifndef TABLES_NEXT_TO_CODE
#define VEC_POLY_INFO_TABLE(nm, bitmap_, \
srt_, srt_off_, srt_len_, \