diff options
author | Ben Gamari <ben@smart-cactus.org> | 2022-10-21 10:59:42 -0400 |
---|---|---|
committer | Matthew Pickering <matthewtpickering@gmail.com> | 2022-10-27 10:20:52 +0100 |
commit | bf9f4645c4b30a43478af22858ea01c2ad8db861 (patch) | |
tree | 7a0a2ccc17a3e096f64027dc37709c2ae046a551 | |
parent | d1151a2f018d29afd449cb9afb9cec033b253f6d (diff) | |
download | haskell-bf9f4645c4b30a43478af22858ea01c2ad8db861.tar.gz |
nonmoving: Tighten up weak pointer assertions
Previously we would use `nonmovingClosureMarkedThisCycle` on objects
which may live in large-object blocks, which is not valid. Fix this by
instead using `nonmovingIsNowAlive`, which handles large objects.
(cherry picked from commit 51bf86503a5920da68ce47d703652f0bd66b9233)
-rw-r--r-- | rts/sm/NonMoving.h | 1 | ||||
-rw-r--r-- | rts/sm/NonMovingMark.c | 6 |
2 files changed, 3 insertions, 4 deletions
diff --git a/rts/sm/NonMoving.h b/rts/sm/NonMoving.h index 25208aceb2..3d7b5771e6 100644 --- a/rts/sm/NonMoving.h +++ b/rts/sm/NonMoving.h @@ -296,7 +296,6 @@ INLINE_HEADER void nonmovingSetClosureMark(StgPtr p) nonmovingSetMark(nonmovingGetSegment(p), nonmovingGetBlockIdx(p)); } -// TODO: Audit the uses of these /* Was the given closure marked this major GC cycle? */ INLINE_HEADER bool nonmovingClosureMarkedThisCycle(StgPtr p) { diff --git a/rts/sm/NonMovingMark.c b/rts/sm/NonMovingMark.c index 2fd85dc4f0..bde650d0de 100644 --- a/rts/sm/NonMovingMark.c +++ b/rts/sm/NonMovingMark.c @@ -1872,7 +1872,7 @@ void nonmovingMarkDeadWeak (struct MarkQueue_ *queue, StgWeak *w) void nonmovingMarkLiveWeak (struct MarkQueue_ *queue, StgWeak *w) { - ASSERT(nonmovingClosureMarkedThisCycle((P_)w)); + ASSERT(nonmovingIsNowAlive((P_)w)); markQueuePushClosure_(queue, w->value); markQueuePushClosure_(queue, w->finalizer); markQueuePushClosure_(queue, w->cfinalizers); @@ -1886,9 +1886,9 @@ void nonmovingMarkDeadWeaks (struct MarkQueue_ *queue, StgWeak **dead_weaks) { StgWeak *next_w; for (StgWeak *w = nonmoving_old_weak_ptr_list; w; w = next_w) { - ASSERT(!nonmovingClosureMarkedThisCycle((P_)(w->key))); + ASSERT(!nonmovingIsNowAlive((P_)(w->key))); nonmovingMarkDeadWeak(queue, w); - next_w = w ->link; + next_w = w->link; w->link = *dead_weaks; *dead_weaks = w; } |