summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2021-09-20 22:43:53 -0400
committerBen Gamari <ben@smart-cactus.org>2021-09-23 23:49:13 -0400
commitb221ff24095f47fe9294ed1504ef28a7910d6a75 (patch)
tree66966c17f7d0587f613de2aa9a4c1149bc382b9e
parent2551e40011817198be6438b903d291de01ca50c4 (diff)
downloadhaskell-wip/gc/nonmoving-mark-check.tar.gz
nonmoving: Mark checkwip/gc/nonmoving-mark-check
-rw-r--r--rts/sm/NonMoving.c8
-rw-r--r--rts/sm/NonMovingMark.c17
2 files changed, 12 insertions, 13 deletions
diff --git a/rts/sm/NonMoving.c b/rts/sm/NonMoving.c
index 9b7978b777..c7858cbb57 100644
--- a/rts/sm/NonMoving.c
+++ b/rts/sm/NonMoving.c
@@ -1185,6 +1185,10 @@ static void nonmovingMark_(MarkQueue *mark_queue, StgWeak **dead_weaks, StgTSO *
}
#endif
+ if (RtsFlags.DebugFlags.nonmoving_mark_check) {
+ nonmovingMarkCheck();
+ }
+
// Everything has been marked; allow the mutators to proceed
#if defined(THREADED_RTS)
nonmoving_write_barrier_enabled = false;
@@ -1199,10 +1203,6 @@ static void nonmovingMark_(MarkQueue *mark_queue, StgWeak **dead_weaks, StgTSO *
oldest_gen->n_old_blocks = 0;
resizeGenerations();
- if (RtsFlags.DebugFlags.nonmoving_mark_check) {
- nonmovingMarkCheck();
- }
-
/****************************************************
* Sweep
****************************************************/
diff --git a/rts/sm/NonMovingMark.c b/rts/sm/NonMovingMark.c
index 2c2a083115..edd75f9cfc 100644
--- a/rts/sm/NonMovingMark.c
+++ b/rts/sm/NonMovingMark.c
@@ -1218,10 +1218,12 @@ mark_closure (MarkQueue *queue, const StgClosure *p0, StgClosure **origin)
switch (type) {
case THUNK_STATIC:
- if (info->srt != 0) {
- if (bump_static_flag(THUNK_STATIC_LINK((StgClosure *)p), p)) {
- markQueuePushThunkSrt(queue, info); // TODO this function repeats the check above
- }
+ // N.B. We must bump the static flag even if there is no SRT
+ // since the thunk may have been updated by the time mark-check
+ // sees it, in which case we won't be able to determine whether
+ // original thunk required marking.
+ if (bump_static_flag(THUNK_STATIC_LINK((StgClosure *)p), p)) {
+ markQueuePushThunkSrt(queue, info); // TODO this function repeats the check above
}
goto done;
@@ -2032,8 +2034,9 @@ static void mark_check_closure(ClosureSet *checked, MarkQueue *queue, StgClosure
// N.B. We use push_closure here since we want to trace all closures, even
// those outside of the nonmoving heap.
+ //
# define PUSH_FIELD(obj, field) \
- push_closure(queue, \
+ push_closure(queue, \
(StgClosure *) (obj)->field, \
(StgClosure **) &(obj)->field)
@@ -2065,10 +2068,6 @@ static void mark_check_closure(ClosureSet *checked, MarkQueue *queue, StgClosure
break;
case IND_STATIC:
- /* If q->saved_info != NULL, then it's a revertible CAF - it'll be
- * on the CAF list, so don't do anything with it here (we'll
- * scavenge it later).
- */
mark_check_static_object(p, IND_STATIC_LINK((StgClosure *)p));
break;