Skip to content

Commit

Permalink
Fix typo in gc_compact_move
Browse files Browse the repository at this point in the history
The page we're sweeping is on the destination heap `dheap`, not the
source heap `heap`.
  • Loading branch information
peterzhu2118 committed Jul 7, 2022
1 parent 7f64989 commit d7c5a6d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion gc.c
Expand Up @@ -5521,6 +5521,7 @@ static inline void
gc_sweep_page(rb_objspace_t *objspace, rb_heap_t *heap, struct gc_sweep_context *ctx)
{
struct heap_page *sweep_page = ctx->page;
GC_ASSERT(SIZE_POOL_EDEN_HEAP(sweep_page->size_pool) == heap);

uintptr_t p;
bits_t *bits, bitset;
Expand Down Expand Up @@ -8321,14 +8322,17 @@ gc_compact_move(rb_objspace_t *objspace, rb_heap_t *heap, rb_size_pool_t *size_p
if (gc_compact_heap_cursors_met_p(dheap)) {
return dheap != heap;
}

while (!try_move(objspace, dheap, dheap->free_pages, src)) {
struct gc_sweep_context ctx = {
.page = dheap->sweeping_page,
.final_slots = 0,
.freed_slots = 0,
.empty_slots = 0,
};
gc_sweep_page(objspace, heap, &ctx);

gc_sweep_page(objspace, dheap, &ctx);

if (dheap->sweeping_page->free_slots > 0) {
heap_add_freepage(dheap, dheap->sweeping_page);
};
Expand Down

0 comments on commit d7c5a6d

Please sign in to comment.