ruby-changes:72450
From: Peter <ko1@a...>
Date: Thu, 7 Jul 2022 22:39:43 +0900 (JST)
Subject: [ruby-changes:72450] d7c5a6d49b (master): Fix typo in gc_compact_move
https://git.ruby-lang.org/ruby.git/commit/?id=d7c5a6d49b From d7c5a6d49ba7fe62f7d2bf538be813234db20783 Mon Sep 17 00:00:00 2001 From: Peter Zhu <peter@p...> Date: Wed, 6 Jul 2022 17:00:13 -0400 Subject: Fix typo in gc_compact_move The page we're sweeping is on the destination heap `dheap`, not the source heap `heap`. --- gc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gc.c b/gc.c index 94837c4d91..29131a8f3a 100644 --- a/gc.c +++ b/gc.c @@ -5521,6 +5521,7 @@ static inline void https://github.com/ruby/ruby/blob/trunk/gc.c#L5521 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; @@ -8321,6 +8322,7 @@ gc_compact_move(rb_objspace_t *objspace, rb_heap_t *heap, rb_size_pool_t *size_p https://github.com/ruby/ruby/blob/trunk/gc.c#L8322 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, @@ -8328,7 +8330,9 @@ gc_compact_move(rb_objspace_t *objspace, rb_heap_t *heap, rb_size_pool_t *size_p https://github.com/ruby/ruby/blob/trunk/gc.c#L8330 .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); }; -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/