ruby-changes:63848
From: Aaron <ko1@a...>
Date: Thu, 3 Dec 2020 01:23:56 +0900 (JST)
Subject: [ruby-changes:63848] 0bebea985d (master): Incremental sweeping should not require page allocation
https://git.ruby-lang.org/ruby.git/commit/?id=0bebea985d From 0bebea985dd1b759973e285e87ed9dfa8610d253 Mon Sep 17 00:00:00 2001 From: Aaron Patterson <tenderlove@r...> Date: Tue, 1 Dec 2020 15:15:14 -0800 Subject: Incremental sweeping should not require page allocation Incremental sweeping should sweep until we find a slot for objects to use. `heap_increment` was adding a page to the heap even though we would sweep immediately after. Co-authored-by: John Hawthorn <john@h...> diff --git a/gc.c b/gc.c index 3daa6a8..a681b0b 100644 --- a/gc.c +++ b/gc.c @@ -1911,6 +1911,8 @@ heap_page_create(rb_objspace_t *objspace) https://github.com/ruby/ruby/blob/trunk/gc.c#L1911 static void heap_add_page(rb_objspace_t *objspace, rb_heap_t *heap, struct heap_page *page) { + /* Adding to eden heap during incremental sweeping is forbidden */ + GC_ASSERT(!(heap == heap_eden && heap->sweeping_page)); page->flags.in_tomb = (heap == heap_tomb); list_add(&heap->pages, &page->page_node); heap->total_pages++; @@ -5095,9 +5097,6 @@ gc_sweep_continue(rb_objspace_t *objspace, rb_heap_t *heap) https://github.com/ruby/ruby/blob/trunk/gc.c#L5097 unsigned int lock_lev; gc_enter(objspace, "sweep_continue", &lock_lev); - if (objspace->rgengc.need_major_gc == GPR_FLAG_NONE && heap_increment(objspace, heap)) { - gc_report(3, objspace, "gc_sweep_continue: success heap_increment().\n"); - } gc_sweep_step(objspace, heap); gc_exit(objspace, "sweep_continue", &lock_lev); } -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/