summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2021-09-30 15:52:59 +0000
committerZubin Duggal <zubin.duggal@gmail.com>2021-10-12 14:54:33 +0530
commit672ca89b42a656f2f6d42bad7bf9f57ce721f754 (patch)
tree64266b84ef467c8f18fb87ee51e7b653cf20bd4d
parentc172d65f8dd0c4ee0ce07575c8b0897782625899 (diff)
downloadhaskell-672ca89b42a656f2f6d42bad7bf9f57ce721f754.tar.gz
rts: Unify stack dirtiness check
This fixes an inconsistency where one dirtiness check would not mask out the STACK_DIRTY flag, meaning it may also be affected by the STACK_SANE flag. (cherry picked from commit 040c347e3cc968d37e76bca228f1f5df997d3672)
-rw-r--r--includes/Cmm.h6
-rw-r--r--rts/PrimOps.cmm6
2 files changed, 6 insertions, 6 deletions
diff --git a/includes/Cmm.h b/includes/Cmm.h
index fc80ff76aa..b21f2c029c 100644
--- a/includes/Cmm.h
+++ b/includes/Cmm.h
@@ -633,6 +633,9 @@
#define OVERWRITING_CLOSURE_MUTABLE(c, off) /* nothing */
#endif
+#define IS_STACK_CLEAN(stack) \
+ ((TO_W_(StgStack_dirty(stack)) & STACK_DIRTY) == 0)
+
// Memory barriers.
// For discussion of how these are used to fence heap object
// accesses see Note [Heap memory barriers] in SMP.h.
@@ -773,9 +776,6 @@
__gen = TO_W_(bdescr_gen_no(__bd)); \
if (__gen > 0) { recordMutableCap(__p, __gen); }
-/* -----------------------------------------------------------------------------
- Update remembered set write barrier
- -------------------------------------------------------------------------- */
/* -----------------------------------------------------------------------------
Arrays
diff --git a/rts/PrimOps.cmm b/rts/PrimOps.cmm
index eb4fa0cdd7..e09c7aaab9 100644
--- a/rts/PrimOps.cmm
+++ b/rts/PrimOps.cmm
@@ -1871,7 +1871,7 @@ loop:
// actually perform the takeMVar
W_ stack;
stack = StgTSO_stackobj(tso);
- if ((TO_W_(StgStack_dirty(stack)) & STACK_DIRTY) == 0) {
+ if (IS_STACK_CLEAN(stack)) {
ccall dirty_STACK(MyCapability() "ptr", stack "ptr");
}
PerformTake(stack, val);
@@ -1961,7 +1961,7 @@ loop:
// actually perform the takeMVar
W_ stack;
stack = StgTSO_stackobj(tso);
- if ((TO_W_(StgStack_dirty(stack)) & STACK_DIRTY) == 0) {
+ if (IS_STACK_CLEAN(stack)) {
ccall dirty_STACK(MyCapability() "ptr", stack "ptr");
}
PerformTake(stack, val);
@@ -2242,7 +2242,7 @@ loop:
// actually perform the takeMVar
W_ stack;
stack = StgTSO_stackobj(tso);
- if (TO_W_(StgStack_dirty(stack)) == 0) {
+ if (IS_STACK_CLEAN(stack)) {
ccall dirty_STACK(MyCapability() "ptr", stack "ptr");
}
PerformTake(stack, val);