summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Patterson <tenderlove@ruby-lang.org>2020-10-23 16:13:11 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2020-12-02 10:47:10 -0800
commit51268be7feace6a6547f8be72d6baf9023b08f2b (patch)
tree89939c78e322b23655df249ac7fab562a12144c7
parent9e73177d5362c1986814f411961b712967dc5f97 (diff)
When allocating new pages, add them to the end of the linked list
When we allocate new pages, allocate them on the end of the linked list. Then when we compact we can move things to the head of the list
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3814
-rw-r--r--gc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gc.c b/gc.c
index a681b0b1fb..306ad0e257 100644
--- a/gc.c
+++ b/gc.c
@@ -1914,7 +1914,7 @@ 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);
+ list_add_tail(&heap->pages, &page->page_node);
heap->total_pages++;
heap->total_slots += page->total_slots;
}
@@ -5036,7 +5036,7 @@ gc_sweep_step(rb_objspace_t *objspace, rb_heap_t *heap)
do {
int free_slots = gc_page_sweep(objspace, heap, sweep_page);
- heap->sweeping_page = list_next(&heap->pages, sweep_page, page_node);
+ heap->sweeping_page = list_next(&heap->pages, sweep_page, page_node);
if (sweep_page->final_slots + free_slots == sweep_page->total_slots &&
heap_pages_freeable_pages > 0 &&