X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;ds=sidebyside;f=ghc%2Fincludes%2FInfoMacros.h;h=6ae87f1bb0d3eacf0faa8ab660e4f77e7d9fe8d6;hb=aaf39182ad0d0dff0a2bbf88596c28e9621b686a;hp=270842ff712d3659c190f96ef84cc56e7c0a750e;hpb=6d40c9e64a408c0de2b60a26dbc8c437433b095c;p=ghc-hetmet.git diff --git a/ghc/includes/InfoMacros.h b/ghc/includes/InfoMacros.h index 270842f..6ae87f1 100644 --- a/ghc/includes/InfoMacros.h +++ b/ghc/includes/InfoMacros.h @@ -1,5 +1,5 @@ /* ---------------------------------------------------------------------------- - * $Id: InfoMacros.h,v 1.7 1999/06/25 09:13:37 simonmar Exp $ + * $Id: InfoMacros.h,v 1.15 2001/07/23 23:14:58 ken Exp $ * * (c) The GHC Team, 1998-1999 * @@ -20,14 +20,56 @@ 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 */ \ @@ -36,65 +78,207 @@ INFO_TABLE_SRT(info, /* info-table label */ \ type, /* closure type */ \ info_class, entry_class, /* C storage classes */ \ prof_descr, prof_type) /* profiling info */ \ + entry_class(stg_RBH_##entry); \ entry_class(entry); \ + ED_RO_ StgInfoTable info; \ + info_class INFO_TBL_CONST StgInfoTable stg_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(stg_RBH_##entry), \ + INIT_VECTOR \ + } ; \ + StgFunPtr stg_RBH_##entry (void) { \ + FB_ \ + JMP_(stg_RBH_entry); \ + FE_ \ + } ; \ 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(stg_RBH_##info), \ INIT_ENTRY(entry), \ INIT_VECTOR \ } +#else + +#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(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(stg_RBH_##entry); \ + entry_class(entry); \ + ED_RO_ StgInfoTable info; \ + 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) { \ + FB_ \ + JMP_(stg_RBH_entry); \ + FE_ \ + } ; \ + info_class INFO_TBL_CONST StgInfoTable info = { \ + layout : { bitmap : (StgWord)bitmap_ }, \ + PROF_INFO(prof_type, prof_descr) \ + SRT_INFO(type,srt_,srt_off_,srt_len_), \ + INCLUDE_RBH_INFO(stg_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, \ 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), \ 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(stg_RBH_##entry); \ + entry_class(entry); \ + ED_ StgInfoTable info; \ + info_class INFO_TBL_CONST StgInfoTable stg_RBH_##info = { \ + layout : { payload : {ptrs,nptrs} }, \ + PROF_INFO(prof_type, prof_descr) \ + STD_INFO(RBH), \ + INCLUDE_RBH_INFO(info), \ + INIT_ENTRY(stg_RBH_##entry), \ + INIT_VECTOR \ + } ; \ + StgFunPtr stg_RBH_##entry (void) { \ + FB_ \ + JMP_(stg_RBH_entry); \ + FE_ \ + } ; \ + info_class INFO_TBL_CONST StgInfoTable info = { \ + layout : { payload : {ptrs,nptrs} }, \ + PROF_INFO(prof_type, prof_descr) \ + STD_INFO(type), \ + INCLUDE_RBH_INFO(stg_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(stg_RBH_##entry); \ + entry_class(entry); \ + ED_RO_ StgInfoTable info; \ + info_class INFO_TBL_CONST StgInfoTable stg_RBH_##info = { \ + layout : { selector_offset : offset }, \ + PROF_INFO(prof_type, prof_descr) \ + STD_INFO(RBH), \ + INCLUDE_RBH_INFO(info), \ + INIT_ENTRY(stg_RBH_##entry), \ + INIT_VECTOR \ + }; \ + StgFunPtr stg_RBH_##entry (void) { \ + FB_ \ + JMP_(stg_RBH_entry); \ + FE_ \ + } ; \ + info_class INFO_TBL_CONST StgInfoTable info = { \ + layout : { selector_offset : offset }, \ + PROF_INFO(prof_type, prof_descr) \ + STD_INFO(THUNK_SELECTOR), \ + INCLUDE_RBH_INFO(stg_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 \ } @@ -153,7 +337,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_) \ } \ } @@ -165,7 +349,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_) \ } \ } @@ -177,7 +361,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_) \ } \ } @@ -191,7 +375,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_) \ } \ } @@ -205,7 +389,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_) \ } \ } @@ -219,7 +403,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_) \ } \ } @@ -233,7 +417,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_) \ } \ } @@ -286,7 +470,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), \ }, \ @@ -298,7 +482,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), \ }, \ @@ -310,7 +494,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), \ }, \ @@ -323,7 +507,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), \ }, \ @@ -337,7 +521,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), \ }, \ @@ -351,7 +535,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), \ }, \ @@ -365,7 +549,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), \ }, \ @@ -388,7 +572,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 \ @@ -422,7 +606,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) \ } \ @@ -442,7 +626,7 @@ typedef vec_info_8 StgPolyInfoTable; to distinguish these kinds of references. (ToDo: fill in a more precise href.) */ -#ifdef HAVE_WIN32_DLL_SUPPORT +#ifdef ENABLE_WIN32_DLL_SUPPORT /* mingw DietHEP doesn't seem to care either way */ #define DLL_SRT_ENTRY(x) ((StgClosure*)(((char*)&DLL_IMPORT_DATA_VAR(x)) + 1)) #else #define DLL_SRT_ENTRY(x) no-can-do