diff options
author | Ian Lynagh <ian@well-typed.com> | 2012-08-25 11:31:50 +0100 |
---|---|---|
committer | Ian Lynagh <ian@well-typed.com> | 2012-08-25 11:31:50 +0100 |
commit | 8413d83859ee0120e52bb1b3cd775b7344b52c76 (patch) | |
tree | 4a4280e8065955b3e08b303fa416587990b68824 /includes/rts/storage/ClosureMacros.h | |
parent | 75f2e87bd7b6b8c0143addc59abfe68456e59591 (diff) | |
download | haskell-8413d83859ee0120e52bb1b3cd775b7344b52c76.tar.gz |
Make a function for get_itbl, rather than using a CPP macro
This has several advantages:
* It can be called from gdb
* There is more type information for the user, and type checking
for the compiler
* Less opportunity for things to go wrong, e.g. due to missing
parentheses or repeated execution
The sizes of the non-debug .o files hasn't changed (other than
Inlines.o), so I'm pretty sure the compiled code is identical.
Diffstat (limited to 'includes/rts/storage/ClosureMacros.h')
-rw-r--r-- | includes/rts/storage/ClosureMacros.h | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/includes/rts/storage/ClosureMacros.h b/includes/rts/storage/ClosureMacros.h index 122f446227..444283897e 100644 --- a/includes/rts/storage/ClosureMacros.h +++ b/includes/rts/storage/ClosureMacros.h @@ -50,12 +50,6 @@ #define GET_INFO(c) ((c)->header.info) #define GET_ENTRY(c) (ENTRY_CODE(GET_INFO(c))) -#define get_itbl(c) (INFO_PTR_TO_STRUCT((c)->header.info)) -#define get_ret_itbl(c) (RET_INFO_PTR_TO_STRUCT((c)->header.info)) -#define get_fun_itbl(c) (FUN_INFO_PTR_TO_STRUCT((c)->header.info)) -#define get_thunk_itbl(c) (THUNK_INFO_PTR_TO_STRUCT((c)->header.info)) -#define get_con_itbl(c) (CON_INFO_PTR_TO_STRUCT((c)->header.info)) - #define GET_TAG(con) (get_itbl(con)->srt_bitmap) #ifdef TABLES_NEXT_TO_CODE @@ -80,6 +74,13 @@ #define itbl_to_con_itbl(i) ((StgConInfoTable *)(i)) #endif +EXTERN_INLINE StgInfoTable *get_itbl(StgClosure *c); +EXTERN_INLINE StgInfoTable *get_itbl(StgClosure *c) {return INFO_PTR_TO_STRUCT(c->header.info);} +#define get_ret_itbl(c) (RET_INFO_PTR_TO_STRUCT((c)->header.info)) +#define get_fun_itbl(c) (FUN_INFO_PTR_TO_STRUCT((c)->header.info)) +#define get_thunk_itbl(c) (THUNK_INFO_PTR_TO_STRUCT((c)->header.info)) +#define get_con_itbl(c) (CON_INFO_PTR_TO_STRUCT((c)->header.info)) + /* ----------------------------------------------------------------------------- Macros for building closures -------------------------------------------------------------------------- */ |