diff options
| author | Ben Gamari <ben@smart-cactus.org> | 2022-12-19 21:59:13 -0500 |
|---|---|---|
| committer | Ben Gamari <ben@smart-cactus.org> | 2023-04-12 07:56:29 -0400 |
| commit | 9c8b194aae9be341f05fbb5e2eb7f0adc6c4aeed (patch) | |
| tree | 09902794ff05c0b591b745a6d2926a6b4c2a7247 | |
| parent | 323a479d5214be639a9ba6e1da6907f00d3a3416 (diff) | |
| download | haskell-9c8b194aae9be341f05fbb5e2eb7f0adc6c4aeed.tar.gz | |
nonmoving: Allow pinned gen0 objects to be WEAK keys
(cherry picked from commit 0c6f15762d14ade2666d5ad7f665718b4a10f89e)
| -rw-r--r-- | rts/sm/NonMovingMark.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/rts/sm/NonMovingMark.c b/rts/sm/NonMovingMark.c index 0352ca81ab..04947b15cc 100644 --- a/rts/sm/NonMovingMark.c +++ b/rts/sm/NonMovingMark.c @@ -1906,16 +1906,26 @@ static bool nonmovingIsNowAlive (StgClosure *p) bdescr *bd = Bdescr((P_)p); - // All non-static objects in the non-moving heap should be marked as - // BF_NONMOVING - ASSERT(bd->flags & BF_NONMOVING); + const uint16_t flags = bd->flags; + if (flags & BF_LARGE) { + if (flags & BF_PINNED && !(flags & BF_NONMOVING)) { + // In this case we have a pinned object living in a non-full + // accumulator block which was not promoted to the nonmoving + // generation. Assume that the object is alive. + // See #22014. + return true; + } - if (bd->flags & BF_LARGE) { + ASSERT(bd->flags & BF_NONMOVING); return (bd->flags & BF_NONMOVING_SWEEPING) == 0 // the large object wasn't in the snapshot and therefore wasn't marked || (bd->flags & BF_MARKED) != 0; // The object was marked } else { + // All non-static objects in the non-moving heap should be marked as + // BF_NONMOVING. + ASSERT(bd->flags & BF_NONMOVING); + struct NonmovingSegment *seg = nonmovingGetSegment((StgPtr) p); StgClosure *snapshot_loc = (StgClosure *) nonmovingSegmentGetBlock(seg, nonmovingSegmentInfo(seg)->next_free_snap); |
