summaryrefslogtreecommitdiff
path: root/includes/rts/storage/ClosureMacros.h
diff options
context:
space:
mode:
Diffstat (limited to 'includes/rts/storage/ClosureMacros.h')
-rw-r--r--includes/rts/storage/ClosureMacros.h33
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);
}
/* -----------------------------------------------------------------------------