diff options
author | Ian Lynagh <ian@well-typed.com> | 2012-08-25 15:42:20 +0100 |
---|---|---|
committer | Ian Lynagh <ian@well-typed.com> | 2012-08-25 15:42:20 +0100 |
commit | 0ab537c563d0b937aaef29e2bb962793d308b174 (patch) | |
tree | 2c6b70c614645504ae4c97af0869834ab7c504cc /includes/rts | |
parent | 773570edf681e26d4cd7f7a628f22c14a73b92fe (diff) | |
download | haskell-0ab537c563d0b937aaef29e2bb962793d308b174.tar.gz |
More CPP macros -> inline functions
All the wibble seem to have cancelled out, and (non-debug) object sizes
are back to where they started.
I'm not 100% sure that the types are optimal, but at least now the
functions have types and we can fix them if necessary.
Diffstat (limited to 'includes/rts')
-rw-r--r-- | includes/rts/storage/ClosureMacros.h | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/includes/rts/storage/ClosureMacros.h b/includes/rts/storage/ClosureMacros.h index fd8151eb5c..4eefb6b881 100644 --- a/includes/rts/storage/ClosureMacros.h +++ b/includes/rts/storage/ClosureMacros.h @@ -53,21 +53,25 @@ #define GET_TAG(con) (get_itbl(con)->srt_bitmap) #ifdef TABLES_NEXT_TO_CODE -#define INFO_PTR_TO_STRUCT(info) ((StgInfoTable *)(info) - 1) -#define RET_INFO_PTR_TO_STRUCT(info) ((StgRetInfoTable *)(info) - 1) -#define FUN_INFO_PTR_TO_STRUCT(info) ((StgFunInfoTable *)(info) - 1) -#define THUNK_INFO_PTR_TO_STRUCT(info) ((StgThunkInfoTable *)(info) - 1) -#define CON_INFO_PTR_TO_STRUCT(info) ((StgConInfoTable *)(info) - 1) +EXTERN_INLINE StgInfoTable *INFO_PTR_TO_STRUCT(const StgInfoTable *info); +EXTERN_INLINE StgInfoTable *INFO_PTR_TO_STRUCT(const StgInfoTable *info) {return (StgInfoTable *)info - 1;} +EXTERN_INLINE StgRetInfoTable *RET_INFO_PTR_TO_STRUCT(const StgInfoTable *info); +EXTERN_INLINE StgRetInfoTable *RET_INFO_PTR_TO_STRUCT(const StgInfoTable *info) {return (StgRetInfoTable *)info - 1;} +INLINE_HEADER StgFunInfoTable *FUN_INFO_PTR_TO_STRUCT(const StgInfoTable *info) {return (StgFunInfoTable *)info - 1;} +INLINE_HEADER StgThunkInfoTable *THUNK_INFO_PTR_TO_STRUCT(const StgInfoTable *info) {return (StgThunkInfoTable *)info - 1;} +INLINE_HEADER StgConInfoTable *CON_INFO_PTR_TO_STRUCT(const StgInfoTable *info) {return (StgConInfoTable *)info - 1;} INLINE_HEADER StgFunInfoTable *itbl_to_fun_itbl(const StgInfoTable *i) {return (StgFunInfoTable *)(i + 1) - 1;} INLINE_HEADER StgRetInfoTable *itbl_to_ret_itbl(const StgInfoTable *i) {return (StgRetInfoTable *)(i + 1) - 1;} INLINE_HEADER StgThunkInfoTable *itbl_to_thunk_itbl(const StgInfoTable *i) {return (StgThunkInfoTable *)(i + 1) - 1;} INLINE_HEADER StgConInfoTable *itbl_to_con_itbl(const StgInfoTable *i) {return (StgConInfoTable *)(i + 1) - 1;} #else -#define INFO_PTR_TO_STRUCT(info) ((StgInfoTable *)info) -#define RET_INFO_PTR_TO_STRUCT(info) ((StgRetInfoTable *)info) -#define FUN_INFO_PTR_TO_STRUCT(info) ((StgFunInfoTable *)info) -#define THUNK_INFO_PTR_TO_STRUCT(info) ((StgThunkInfoTable *)info) -#define CON_INFO_PTR_TO_STRUCT(info) ((StgConInfoTable *)info) +EXTERN_INLINE StgInfoTable *INFO_PTR_TO_STRUCT(const StgInfoTable *info); +EXTERN_INLINE StgInfoTable *INFO_PTR_TO_STRUCT(const StgInfoTable *info) {return (StgInfoTable *)info;} +EXTERN_INLINE StgRetInfoTable *RET_INFO_PTR_TO_STRUCT(const StgInfoTable *info); +EXTERN_INLINE StgRetInfoTable *RET_INFO_PTR_TO_STRUCT(const StgInfoTable *info) {return (StgRetInfoTable *)info;} +INLINE_HEADER StgThunkInfoTable *FUN_INFO_PTR_TO_STRUCT(const StgInfoTable *info) {return (StgFunInfoTable *)info;} +INLINE_HEADER StgThunkInfoTable *THUNK_INFO_PTR_TO_STRUCT(const StgInfoTable *info) {return (StgThunkInfoTable *)info;} +INLINE_HEADER StgConInfoTable *CON_INFO_PTR_TO_STRUCT(const StgInfoTable *info) {return (StgConInfoTable *)info;} INLINE_HEADER StgFunInfoTable *itbl_to_fun_itbl(const StgInfoTable *i) {return (StgFunInfoTable *)i;} INLINE_HEADER StgRetInfoTable *itbl_to_ret_itbl(const StgInfoTable *i) {return (StgRetInfoTable *)i;} INLINE_HEADER StgThunkInfoTable *itbl_to_thunk_itbl(const StgInfoTable *i) {return (StgThunkInfoTable *)i;} @@ -227,7 +231,7 @@ TAG_CLOSURE(StgWord tag,StgClosure * p) INLINE_HEADER rtsBool LOOKS_LIKE_INFO_PTR_NOT_NULL (StgWord p) { - StgInfoTable *info = INFO_PTR_TO_STRUCT(p); + StgInfoTable *info = INFO_PTR_TO_STRUCT((StgInfoTable *)p); return info->type != INVALID_OBJECT && info->type < N_CLOSURE_TYPES; } |