ruby-changes:70047
From: Peter <ko1@a...>
Date: Sat, 4 Dec 2021 00:26:36 +0900 (JST)
Subject: [ruby-changes:70047] 081539023a (master): Refactor GC functions to have consistent naming
https://git.ruby-lang.org/ruby.git/commit/?id=081539023a From 081539023adc2a5ed4466ef54767c5e0c4d72ace Mon Sep 17 00:00:00 2001 From: Peter Zhu <peter@p...> Date: Thu, 2 Dec 2021 16:27:43 -0500 Subject: Refactor GC functions to have consistent naming Refactor function names for consistency. Function with name xyz_page should have a corresponding function named xyz_plane. --- gc.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/gc.c b/gc.c index f889cbb81b1..38f0fd2ce18 100644 --- a/gc.c +++ b/gc.c @@ -4868,7 +4868,7 @@ unlock_page_body(rb_objspace_t *objspace, struct heap_page_body *body) https://github.com/ruby/ruby/blob/trunk/gc.c#L4868 } static inline bool -try_move_in_plane(rb_objspace_t *objspace, rb_heap_t *heap, struct heap_page *page, uintptr_t p, bits_t bits, VALUE dest) +try_move_plane(rb_objspace_t *objspace, rb_heap_t *heap, struct heap_page *page, uintptr_t p, bits_t bits, VALUE dest) { if (bits) { do { @@ -4936,7 +4936,7 @@ try_move(rb_objspace_t *objspace, rb_heap_t *heap, struct heap_page *sweep_page, https://github.com/ruby/ruby/blob/trunk/gc.c#L4936 bits_t bits = mark_bits[index] & ~pin_bits[index]; bits >>= NUM_IN_PAGE(p); - if (try_move_in_plane(objspace, heap, sweep_page, (uintptr_t)p, bits, dest)) return 1; + if (try_move_plane(objspace, heap, sweep_page, (uintptr_t)p, bits, dest)) return 1; if (index == 0) { p = cursor->start + (BITS_BITLENGTH - NUM_IN_PAGE(cursor->start)); @@ -4949,7 +4949,7 @@ try_move(rb_objspace_t *objspace, rb_heap_t *heap, struct heap_page *sweep_page, https://github.com/ruby/ruby/blob/trunk/gc.c#L4949 * marked, so we iterate using the marking bitmap */ for (size_t i = index + 1; i < HEAP_PAGE_BITMAP_LIMIT; i++) { bits_t bits = mark_bits[i] & ~pin_bits[i]; - if (try_move_in_plane(objspace, heap, sweep_page, (uintptr_t)p, bits, dest)) return 1; + if (try_move_plane(objspace, heap, sweep_page, (uintptr_t)p, bits, dest)) return 1; p += BITS_BITLENGTH; } @@ -5181,7 +5181,7 @@ struct gc_sweep_context { https://github.com/ruby/ruby/blob/trunk/gc.c#L5181 }; static inline void -gc_fill_swept_page_plane(rb_objspace_t *objspace, rb_heap_t *heap, uintptr_t p, bits_t bitset, bool *finished_compacting, struct gc_sweep_context *ctx) +gc_fill_swept_plane(rb_objspace_t *objspace, rb_heap_t *heap, uintptr_t p, bits_t bitset, bool *finished_compacting, struct gc_sweep_context *ctx) { struct heap_page * sweep_page = ctx->page; @@ -5258,13 +5258,13 @@ gc_fill_swept_page(rb_objspace_t *objspace, rb_heap_t *heap, struct heap_page *s https://github.com/ruby/ruby/blob/trunk/gc.c#L5258 /* *Want to move* objects are pinned but not marked. */ bitset = pin_bits[0] & ~mark_bits[0]; bitset >>= NUM_IN_PAGE(p); // Skip header / dead space bits - gc_fill_swept_page_plane(objspace, heap, (uintptr_t)p, bitset, &finished_compacting, ctx); + gc_fill_swept_plane(objspace, heap, (uintptr_t)p, bitset, &finished_compacting, ctx); p += ((BITS_BITLENGTH - NUM_IN_PAGE(p)) * sizeof(RVALUE)); for (int i = 1; i < HEAP_PAGE_BITMAP_LIMIT; i++) { /* *Want to move* objects are pinned but not marked. */ bitset = pin_bits[i] & ~mark_bits[i]; - gc_fill_swept_page_plane(objspace, heap, (uintptr_t)p, bitset, &finished_compacting, ctx); + gc_fill_swept_plane(objspace, heap, (uintptr_t)p, bitset, &finished_compacting, ctx); p += ((BITS_BITLENGTH) * sizeof(RVALUE)); } @@ -5274,7 +5274,7 @@ gc_fill_swept_page(rb_objspace_t *objspace, rb_heap_t *heap, struct heap_page *s https://github.com/ruby/ruby/blob/trunk/gc.c#L5274 } static inline void -gc_plane_sweep(rb_objspace_t *objspace, rb_heap_t *heap, uintptr_t p, bits_t bitset, struct gc_sweep_context *ctx) +gc_sweep_plane(rb_objspace_t *objspace, rb_heap_t *heap, uintptr_t p, bits_t bitset, struct gc_sweep_context *ctx) { struct heap_page * sweep_page = ctx->page; short slot_size = sweep_page->slot_size; @@ -5351,7 +5351,7 @@ gc_plane_sweep(rb_objspace_t *objspace, rb_heap_t *heap, uintptr_t p, bits_t bit https://github.com/ruby/ruby/blob/trunk/gc.c#L5351 } static inline void -gc_page_sweep(rb_objspace_t *objspace, rb_size_pool_t *size_pool, rb_heap_t *heap, struct gc_sweep_context *ctx) +gc_sweep_page(rb_objspace_t *objspace, rb_size_pool_t *size_pool, rb_heap_t *heap, struct gc_sweep_context *ctx) { struct heap_page *sweep_page = ctx->page; @@ -5392,14 +5392,14 @@ gc_page_sweep(rb_objspace_t *objspace, rb_size_pool_t *size_pool, rb_heap_t *hea https://github.com/ruby/ruby/blob/trunk/gc.c#L5392 bitset = ~bits[0]; bitset >>= NUM_IN_PAGE(p); if (bitset) { - gc_plane_sweep(objspace, heap, (uintptr_t)p, bitset, ctx); + gc_sweep_plane(objspace, heap, (uintptr_t)p, bitset, ctx); } p += (BITS_BITLENGTH - NUM_IN_PAGE(p)); for (i=1; i < HEAP_PAGE_BITMAP_LIMIT; i++) { bitset = ~bits[i]; if (bitset) { - gc_plane_sweep(objspace, heap, (uintptr_t)p, bitset, ctx); + gc_sweep_plane(objspace, heap, (uintptr_t)p, bitset, ctx); } p += BITS_BITLENGTH; } @@ -5421,7 +5421,7 @@ gc_page_sweep(rb_objspace_t *objspace, rb_size_pool_t *size_pool, rb_heap_t *hea https://github.com/ruby/ruby/blob/trunk/gc.c#L5421 record->empty_objects += ctx->empty_slots; } #endif - if (0) fprintf(stderr, "gc_page_sweep(%"PRIdSIZE"): total_slots: %d, freed_slots: %d, empty_slots: %d, final_slots: %d\n", + if (0) fprintf(stderr, "gc_sweep_page(%"PRIdSIZE"): total_slots: %d, freed_slots: %d, empty_slots: %d, final_slots: %d\n", rb_gc_count(), sweep_page->total_slots, ctx->freed_slots, ctx->empty_slots, ctx->final_slots); @@ -5675,7 +5675,7 @@ gc_sweep_step(rb_objspace_t *objspace, rb_size_pool_t *size_pool, rb_heap_t *hea https://github.com/ruby/ruby/blob/trunk/gc.c#L5675 .freed_slots = 0, .empty_slots = 0, }; - gc_page_sweep(objspace, size_pool, heap, &ctx); + gc_sweep_page(objspace, size_pool, heap, &ctx); int free_slots = ctx.freed_slots + ctx.empty_slots; heap->sweeping_page = list_next(&heap->pages, sweep_page, page_node); @@ -7865,7 +7865,7 @@ gc_marks_start(rb_objspace_t *objspace, int full_mark) https://github.com/ruby/ruby/blob/trunk/gc.c#L7865 #if GC_ENABLE_INCREMENTAL_MARK static inline void -gc_marks_wb_unprotected_objects_in_plane(rb_objspace_t *objspace, uintptr_t p, bits_t bits) +gc_marks_wb_unprotected_objects_plane(rb_objspace_t *objspace, uintptr_t p, bits_t bits) { if (bits) { do { @@ -7894,13 +7894,13 @@ gc_marks_wb_unprotected_objects(rb_objspace_t *objspace, rb_heap_t *heap) https://github.com/ruby/ruby/blob/trunk/gc.c#L7894 bits_t bits = mark_bits[0] & wbun_bits[0]; bits >>= NUM_IN_PAGE(p); - gc_marks_wb_unprotected_objects_in_plane(objspace, (uintptr_t)p, bits); + gc_marks_wb_unprotected_objects_plane(objspace, (uintptr_t)p, bits); p += (BITS_BITLENGTH - NUM_IN_PAGE(p)); for (j=1; j<HEAP_PAGE_BITMAP_LIMIT; j++) { bits_t bits = mark_bits[j] & wbun_bits[j]; - gc_marks_wb_unprotected_objects_in_plane(objspace, (uintptr_t)p, bits); + gc_marks_wb_unprotected_objects_plane(objspace, (uintptr_t)p, bits); p += BITS_BITLENGTH; } } @@ -8275,7 +8275,7 @@ rgengc_remembered(rb_objspace_t *objspace, VALUE obj) https://github.com/ruby/ruby/blob/trunk/gc.c#L8275 #endif static inline void -rgengc_rememberset_mark_in_plane(rb_objspace_t *objspace, uintptr_t p, bits_t bitset) +rgengc_rememberset_mark_plane(rb_objspace_t *objspace, uintptr_t p, bits_t bitset) { if (bitset) { do { @@ -8323,12 +8323,12 @@ rgengc_rememberset_mark(rb_objspace_t *objspace, rb_heap_t *heap) https://github.com/ruby/ruby/blob/trunk/gc.c#L8323 bitset = bits[0]; bitset >>= NUM_IN_PAGE(p); - rgengc_rememberset_mark_in_plane(objspace, (uintptr_t)p, bitset); + rgengc_rememberset_mark_plane(objspace, (uintptr_t)p, bitset); p += (BITS_BITLENGTH - NUM_IN_PAGE(p)); for (j=1; j < HEAP_PAGE_BITMAP_LIMIT; j++) { bitset = bits[j]; - rgengc_rememberset_mark_in_plane(objspace, (uintptr_t)p, bitset); + rgengc_rememberset_mark_plane(objspace, (uintptr_t)p, bitset); p += BITS_BITLENGTH; } } -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/