From 081539023adc2a5ed4466ef54767c5e0c4d72ace Mon Sep 17 00:00:00 2001 From: Peter Zhu 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(-) (limited to 'gc.c') diff --git a/gc.c b/gc.c index f889cbb81b..38f0fd2ce1 100644 --- a/gc.c +++ b/gc.c @@ -4868,7 +4868,7 @@ unlock_page_body(rb_objspace_t *objspace, struct heap_page_body *body) } 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, 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, * 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 { }; 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 /* *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 } 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 } 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 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 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 .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) #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) 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>= 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.3