Commit a8716159 authored by Ben Gamari's avatar Ben Gamari 🐢

NonMovingScav: Account for new allocations

Previously if we evacuated any objects to the segment that we were
scavenging we would exit the scavenge loop before having scavenged them.
This isn't a correctness issue since we would try again to scavenge
later but it is slightly more efficient to handle newly-allocated
objects ASAP after we allocate them.
parent 9dfd529c
......@@ -373,13 +373,12 @@ scavengeNonmovingSegment (struct NonmovingSegment *seg)
ASSERT(seg_block->u.scan >= (P_)nonmovingSegmentGetBlock(seg, 0));
ASSERT(seg_block->u.scan <= (P_)nonmovingSegmentGetBlock(seg, seg->next_free));
StgPtr scan_end = (P_)nonmovingSegmentGetBlock(seg, seg->next_free);
if (seg_block->u.scan == scan_end)
nonmoving_block_idx p_idx = nonmovingGetBlockIdx(seg_block->u.scan);
if (p_idx == seg->next_free)
trace_dump_note("scavenging segment");
nonmoving_block_idx p_idx = nonmovingGetBlockIdx(seg_block->u.scan);
while (seg_block->u.scan < scan_end) {
while (p_idx < seg->next_free) {
StgClosure *p = (StgClosure*)seg_block->u.scan;
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment