summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2022-10-21 04:10:29 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2023-03-08 15:02:30 -0500
commitbe2789014b208db5c471ab187e7dba2ebc59f8c8 (patch)
tree148212fdaffab57e15d3efb5ff2ffb71411d081e
parentabb6070f488120aef113b686e91b439fe6c3d272 (diff)
downloadhaskell-be2789014b208db5c471ab187e7dba2ebc59f8c8.tar.gz
nonmoving: Deduplicate assertion
-rw-r--r--rts/sm/NonMoving.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/rts/sm/NonMoving.h b/rts/sm/NonMoving.h
index 37d3581882..fcbf6ca89b 100644
--- a/rts/sm/NonMoving.h
+++ b/rts/sm/NonMoving.h
@@ -258,15 +258,22 @@ INLINE_HEADER struct NonmovingSegment *nonmovingGetSegment_unchecked(StgPtr p)
return (struct NonmovingSegment *) (((uintptr_t) p) & mask);
}
+INLINE_HEADER bool nonmovingIsInSegment(StgPtr p)
+{
+ bdescr *bd = Bdescr(p);
+ return HEAP_ALLOCED_GC(p) &&
+ (bd->flags & BF_NONMOVING) &&
+ !(bd->flags & BF_LARGE);
+}
+
INLINE_HEADER struct NonmovingSegment *nonmovingGetSegment(StgPtr p)
{
- ASSERT(HEAP_ALLOCED_GC(p) && (Bdescr(p)->flags & BF_NONMOVING));
+ ASSERT(nonmovingIsInSegment(p));
return nonmovingGetSegment_unchecked(p);
}
INLINE_HEADER nonmoving_block_idx nonmovingGetBlockIdx(StgPtr p)
{
- ASSERT(HEAP_ALLOCED_GC(p) && (Bdescr(p)->flags & BF_NONMOVING));
struct NonmovingSegment *seg = nonmovingGetSegment(p);
ptrdiff_t blk0 = (ptrdiff_t)nonmovingSegmentGetBlock(seg, 0);
ptrdiff_t offset = (ptrdiff_t)p - blk0;