summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2019-09-30 00:06:07 +0000
committerBen Gamari <ben@smart-cactus.org>2020-10-24 20:59:39 -0400
commit33a719c392be4d8a389a1331c6c88093148f7396 (patch)
tree9412954eab0316f316674c80dfb144b35fb8ed38 /includes
parentef88712f5dcc9e245b4e3819be1889e659731b59 (diff)
downloadhaskell-33a719c392be4d8a389a1331c6c88093148f7396.tar.gz
rts/ClosureMaros: Use relaxed atomics
Diffstat (limited to 'includes')
-rw-r--r--includes/rts/storage/ClosureMacros.h23
1 files changed, 13 insertions, 10 deletions
diff --git a/includes/rts/storage/ClosureMacros.h b/includes/rts/storage/ClosureMacros.h
index 0e956c4fa3..89d5cd1d0e 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,7 +140,7 @@ INLINE_HEADER StgHalfWord GET_TAG(const StgClosure *con)
#define SET_HDR(c,_info,ccs) \
{ \
- (c)->header.info = _info; \
+ RELAXED_STORE(&(c)->header.info, _info); \
SET_PROF_HDR((StgClosure *)(c),ccs); \
}
@@ -251,8 +254,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);
}
/* -----------------------------------------------------------------------------