diff options
author | Ben Gamari <ben@smart-cactus.org> | 2020-11-08 09:29:16 -0500 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2020-11-08 09:29:16 -0500 |
commit | 638f38c50e80a19275f3a06535a0dd8130a17a53 (patch) | |
tree | ac18855cd2f39544e4841866fbabb3f86a4d1f35 /includes/rts/storage/ClosureMacros.h | |
parent | b1d2c1f3246b3740589a59bdf7648c13de47c32b (diff) | |
parent | 07e82ba52228580cfbd90ff031e657acbecc715b (diff) | |
download | haskell-638f38c50e80a19275f3a06535a0dd8130a17a53.tar.gz |
Merge remote-tracking branch 'origin/wip/tsan/all'
Diffstat (limited to 'includes/rts/storage/ClosureMacros.h')
-rw-r--r-- | includes/rts/storage/ClosureMacros.h | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/includes/rts/storage/ClosureMacros.h b/includes/rts/storage/ClosureMacros.h index 0e956c4fa3..5674322bd2 100644 --- a/includes/rts/storage/ClosureMacros.h +++ b/includes/rts/storage/ClosureMacros.h @@ -46,10 +46,13 @@ -------------------------------------------------------------------------- */ INLINE_HEADER void SET_INFO(StgClosure *c, const StgInfoTable *info) { - c->header.info = info; + RELAXED_STORE(&c->header.info, info); +} +INLINE_HEADER void SET_INFO_RELEASE(StgClosure *c, const StgInfoTable *info) { + RELEASE_STORE(&c->header.info, info); } INLINE_HEADER const StgInfoTable *GET_INFO(StgClosure *c) { - return c->header.info; + return RELAXED_LOAD(&c->header.info); } #if defined(TABLES_NEXT_TO_CODE) @@ -81,28 +84,28 @@ INLINE_HEADER StgConInfoTable *itbl_to_con_itbl(const StgInfoTable *i) {return ( EXTERN_INLINE const StgInfoTable *get_itbl(const StgClosure *c); EXTERN_INLINE const StgInfoTable *get_itbl(const StgClosure *c) { - return INFO_PTR_TO_STRUCT(c->header.info); + return INFO_PTR_TO_STRUCT(RELAXED_LOAD(&c->header.info)); } EXTERN_INLINE const StgRetInfoTable *get_ret_itbl(const StgClosure *c); EXTERN_INLINE const StgRetInfoTable *get_ret_itbl(const StgClosure *c) { - return RET_INFO_PTR_TO_STRUCT(c->header.info); + return RET_INFO_PTR_TO_STRUCT(RELAXED_LOAD(&c->header.info)); } INLINE_HEADER const StgFunInfoTable *get_fun_itbl(const StgClosure *c) { - return FUN_INFO_PTR_TO_STRUCT(c->header.info); + return FUN_INFO_PTR_TO_STRUCT(RELAXED_LOAD(&c->header.info)); } INLINE_HEADER const StgThunkInfoTable *get_thunk_itbl(const StgClosure *c) { - return THUNK_INFO_PTR_TO_STRUCT(c->header.info); + return THUNK_INFO_PTR_TO_STRUCT(RELAXED_LOAD(&c->header.info)); } INLINE_HEADER const StgConInfoTable *get_con_itbl(const StgClosure *c) { - return CON_INFO_PTR_TO_STRUCT((c)->header.info); + return CON_INFO_PTR_TO_STRUCT(RELAXED_LOAD(&c->header.info)); } INLINE_HEADER StgHalfWord GET_TAG(const StgClosure *con) @@ -137,13 +140,19 @@ INLINE_HEADER StgHalfWord GET_TAG(const StgClosure *con) #define SET_HDR(c,_info,ccs) \ { \ - (c)->header.info = _info; \ SET_PROF_HDR((StgClosure *)(c),ccs); \ + RELAXED_STORE(&(c)->header.info, _info); \ + } + +#define SET_HDR_RELEASE(c,_info,ccs) \ + { \ + SET_PROF_HDR((StgClosure *)(c),ccs); \ + RELEASE_STORE(&(c)->header.info, _info); \ } #define SET_ARR_HDR(c,info,costCentreStack,n_bytes) \ - SET_HDR(c,info,costCentreStack); \ - (c)->bytes = n_bytes; + (c)->bytes = n_bytes; \ + SET_HDR(c,info,costCentreStack); // Use when changing a closure from one kind to another #define OVERWRITE_INFO(c, new_info) \ @@ -251,8 +260,8 @@ INLINE_HEADER bool LOOKS_LIKE_INFO_PTR (StgWord p) INLINE_HEADER bool LOOKS_LIKE_CLOSURE_PTR (const void *p) { - return LOOKS_LIKE_INFO_PTR((StgWord) - (UNTAG_CONST_CLOSURE((const StgClosure *)(p)))->header.info); + const StgInfoTable *info = RELAXED_LOAD(&UNTAG_CONST_CLOSURE((const StgClosure *) (p))->header.info); + return LOOKS_LIKE_INFO_PTR((StgWord) info); } /* ----------------------------------------------------------------------------- |