Skip to content
Snippets Groups Projects
Commit 49c2986e authored by Teo Camarasu's avatar Teo Camarasu Committed by Zubin
Browse files

rts: avoid checking bdescr of value outside of Haskell heap

In nonmovingTidyWeaks we want to check if the key of a weak pointer
lives in the non-moving heap. We do this by checking the flags of the
block the key lives in. But we need to be careful with values that live
outside the Haskell heap, since they will lack a block descriptor and
looking for one may lead to a segfault. In this case we should just
accept that it isn't on the non-moving heap.

Resolves #24492

(cherry picked from commit 74b24a9b)
parent b895d534
No related branches found
No related tags found
No related merge requests found
...@@ -2008,7 +2008,7 @@ bool nonmovingTidyWeaks (struct MarkQueue_ *queue) ...@@ -2008,7 +2008,7 @@ bool nonmovingTidyWeaks (struct MarkQueue_ *queue)
// See Note [Weak pointer processing and the non-moving GC] in // See Note [Weak pointer processing and the non-moving GC] in
// MarkWeak.c // MarkWeak.c
bool key_in_nonmoving = Bdescr((StgPtr) w->key)->flags & BF_NONMOVING; bool key_in_nonmoving = HEAP_ALLOCED_GC(w->key) && Bdescr((StgPtr) w->key)->flags & BF_NONMOVING;
if (!key_in_nonmoving || nonmovingIsNowAlive(w->key)) { if (!key_in_nonmoving || nonmovingIsNowAlive(w->key)) {
nonmovingMarkLiveWeak(queue, w); nonmovingMarkLiveWeak(queue, w);
did_work = true; did_work = true;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment