summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2019-05-11 19:32:17 -0400
committerBen Gamari <ben@smart-cactus.org>2019-10-22 12:18:39 -0400
commit0387df5bfd166f82ee11d4ce7d96eb52bf1ba9f7 (patch)
tree2d140a2ea7259a80a4494ce410161c63a91b2063
parent786c52d25e94e578a7d76772fbc18fac0ea1b458 (diff)
downloadhaskell-0387df5bfd166f82ee11d4ce7d96eb52bf1ba9f7.tar.gz
NonMoving: Inline nonmovingClearAllBitmaps
-rw-r--r--rts/sm/NonMoving.c35
1 files changed, 10 insertions, 25 deletions
diff --git a/rts/sm/NonMoving.c b/rts/sm/NonMoving.c
index b8c690d4a0..60416cb0e3 100644
--- a/rts/sm/NonMoving.c
+++ b/rts/sm/NonMoving.c
@@ -488,35 +488,12 @@ void nonmovingAddCapabilities(uint32_t new_n_caps)
nonmovingHeap.n_caps = new_n_caps;
}
-static void nonmovingClearBitmap(struct NonmovingSegment *seg)
+static inline void nonmovingClearBitmap(struct NonmovingSegment *seg)
{
unsigned int n = nonmovingSegmentBlockCount(seg);
memset(seg->bitmap, 0, n);
}
-static void nonmovingClearSegmentBitmaps(struct NonmovingSegment *seg)
-{
- while (seg) {
- prefetchForRead(seg->link);
- prefetchForWrite(seg->link->bitmap);
- nonmovingClearBitmap(seg);
- seg = seg->link;
- }
-}
-
-static void nonmovingClearAllBitmaps(void)
-{
- for (int alloca_idx = 0; alloca_idx < NONMOVING_ALLOCA_CNT; ++alloca_idx) {
- struct NonmovingAllocator *alloca = nonmovingHeap.allocators[alloca_idx];
- nonmovingClearSegmentBitmaps(alloca->filled);
- }
-
- // Clear large object bits
- for (bdescr *bd = nonmoving_large_objects; bd; bd = bd->link) {
- bd->flags &= ~BF_MARKED;
- }
-}
-
/* Prepare the heap bitmaps and snapshot metadata for a mark */
static void nonmovingPrepareMark(void)
{
@@ -525,7 +502,6 @@ static void nonmovingPrepareMark(void)
static_flag =
static_flag == STATIC_FLAG_A ? STATIC_FLAG_B : STATIC_FLAG_A;
- nonmovingClearAllBitmaps();
nonmovingBumpEpoch();
for (int alloca_idx = 0; alloca_idx < NONMOVING_ALLOCA_CNT; ++alloca_idx) {
struct NonmovingAllocator *alloca = nonmovingHeap.allocators[alloca_idx];
@@ -539,6 +515,9 @@ static void nonmovingPrepareMark(void)
// Update filled segments' snapshot pointers
struct NonmovingSegment *seg = alloca->filled;
while (seg) {
+ prefetchForRead(seg->link);
+ prefetchForWrite(seg->link->bitmap);
+ nonmovingClearBitmap(seg);
seg->next_free_snap = seg->next_free;
seg = seg->link;
}
@@ -561,6 +540,12 @@ static void nonmovingPrepareMark(void)
oldest_gen->n_large_blocks = 0;
nonmoving_live_words = 0;
+ // Clear large object bits
+ for (bdescr *bd = nonmoving_large_objects; bd; bd = bd->link) {
+ bd->flags &= ~BF_MARKED;
+ }
+
+
#if defined(DEBUG)
debug_caf_list_snapshot = debug_caf_list;
debug_caf_list = (StgIndStatic*)END_OF_CAF_LIST;