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) ...@@ -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, 0));
ASSERT(seg_block->u.scan <= (P_)nonmovingSegmentGetBlock(seg, seg->next_free)); ASSERT(seg_block->u.scan <= (P_)nonmovingSegmentGetBlock(seg, seg->next_free));
StgPtr scan_end = (P_)nonmovingSegmentGetBlock(seg, seg->next_free); nonmoving_block_idx p_idx = nonmovingGetBlockIdx(seg_block->u.scan);
if (seg_block->u.scan == scan_end) if (p_idx == seg->next_free)
return; return;
trace_dump_note("scavenging segment"); trace_dump_note("scavenging segment");
nonmoving_block_idx p_idx = nonmovingGetBlockIdx(seg_block->u.scan); while (p_idx < seg->next_free) {
while (seg_block->u.scan < scan_end) {
StgClosure *p = (StgClosure*)seg_block->u.scan; StgClosure *p = (StgClosure*)seg_block->u.scan;
trace_dump_set_source_closure(p); trace_dump_set_source_closure(p);
......
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