diff options
| author | Ben Gamari <ben@smart-cactus.org> | 2022-10-21 04:10:29 +0000 |
|---|---|---|
| committer | Ben Gamari <ben@smart-cactus.org> | 2023-04-12 07:43:20 -0400 |
| commit | 2dd2351292b18197f1027eb9802cdd6c106c7df5 (patch) | |
| tree | 0652271fd77f5d47392efce498ecf352a4800e8b | |
| parent | 03e3094084d3818cf96fe34b6e444679161ed11a (diff) | |
| download | haskell-2dd2351292b18197f1027eb9802cdd6c106c7df5.tar.gz | |
nonmoving: Deduplicate assertion
(cherry picked from commit 1cc4bd7a169c6d813330d3613836889568515000)
| -rw-r--r-- | rts/sm/NonMoving.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/rts/sm/NonMoving.h b/rts/sm/NonMoving.h index 3aabe03e8f..0ccb56545c 100644 --- a/rts/sm/NonMoving.h +++ b/rts/sm/NonMoving.h @@ -255,15 +255,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; |
