diff options
author | Simon Marlow <marlowsd@gmail.com> | 2008-09-08 14:43:48 +0000 |
---|---|---|
committer | Simon Marlow <marlowsd@gmail.com> | 2008-09-08 14:43:48 +0000 |
commit | fef454a0f84acdf9e4efbce6425a04fbbb577dbe (patch) | |
tree | 65771d4fe86d7532e41b9e25c4d51d0db2e7854e /includes | |
parent | 9c325bab1e7ed7d305a79ef9e366b6ac87b8b1b6 (diff) | |
download | haskell-fef454a0f84acdf9e4efbce6425a04fbbb577dbe.tar.gz |
Make LOOKS_LIKE_{INFO,CLOSURE}_PTR into inline functions, instead of macros
The macros were duplicating their arguments, which was normally
harmless, but in the parallel GC was actually wrong and caused
spurious assertion failures.
Diffstat (limited to 'includes')
-rw-r--r-- | includes/Storage.h | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/includes/Storage.h b/includes/Storage.h index caa7c1d16d..2b8f107196 100644 --- a/includes/Storage.h +++ b/includes/Storage.h @@ -359,15 +359,8 @@ void dirty_MUT_VAR(StgRegTable *reg, StgClosure *p); make sense... -------------------------------------------------------------------------- */ -#define LOOKS_LIKE_INFO_PTR(p) \ - (p && (IS_FORWARDING_PTR(p) || LOOKS_LIKE_INFO_PTR_NOT_NULL(p))) - -#define LOOKS_LIKE_INFO_PTR_NOT_NULL(p) \ - (((StgInfoTable *)(INFO_PTR_TO_STRUCT(p)))->type != INVALID_OBJECT && \ - ((StgInfoTable *)(INFO_PTR_TO_STRUCT(p)))->type < N_CLOSURE_TYPES) - -#define LOOKS_LIKE_CLOSURE_PTR(p) \ - (LOOKS_LIKE_INFO_PTR((UNTAG_CLOSURE((StgClosure *)(p)))->header.info)) +INLINE_HEADER rtsBool LOOKS_LIKE_INFO_PTR (StgWord p); +INLINE_HEADER rtsBool LOOKS_LIKE_CLOSURE_PTR (void *p); // XXX StgClosure* /* ----------------------------------------------------------------------------- Macros for calculating how big a closure will be (used during allocation) @@ -599,4 +592,20 @@ extern StgTSO * RTS_VAR(resurrected_threads); #define MK_FORWARDING_PTR(p) (((StgWord)p) | 1) #define UN_FORWARDING_PTR(p) (((StgWord)p) - 1) +INLINE_HEADER rtsBool LOOKS_LIKE_INFO_PTR_NOT_NULL (StgWord p) +{ + StgInfoTable *info = INFO_PTR_TO_STRUCT(p); + return info->type != INVALID_OBJECT && info->type < N_CLOSURE_TYPES; +} + +INLINE_HEADER rtsBool LOOKS_LIKE_INFO_PTR (StgWord p) +{ + return p && (IS_FORWARDING_PTR(p) || LOOKS_LIKE_INFO_PTR_NOT_NULL(p)); +} + +INLINE_HEADER rtsBool LOOKS_LIKE_CLOSURE_PTR (void *p) +{ + return LOOKS_LIKE_INFO_PTR((StgWord)(UNTAG_CLOSURE((StgClosure *)(p)))->header.info); +} + #endif /* STORAGE_H */ |