Commit 67905e83 authored by Ben Gamari's avatar Ben Gamari 🐢

NonMoving: Inline nonmovingClearAllBitmaps

parent d5b62460
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment