ruby-changes:60196
From: =E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3 <ko1@a...>
Date: Wed, 26 Feb 2020 16:00:30 +0900 (JST)
Subject: [ruby-changes:60196] 62c2b8c74e (master): kill USE_RGENGC=0
https://git.ruby-lang.org/ruby.git/commit/?id=62c2b8c74e From 62c2b8c74e47652fc5bbaf6150f4acd092dfd72b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3?= <shyouhei@r...> Date: Tue, 25 Feb 2020 14:36:56 +0900 Subject: kill USE_RGENGC=0 This compile-time option has been broken for years (at least since commit 49369ef17316cd5d5819b038f286e1d951972b52, according to git bisect). Let's delete codes that no longer works. diff --git a/gc.c b/gc.c index 7d24235..82f3d63 100644 --- a/gc.c +++ b/gc.c @@ -393,7 +393,6 @@ static ruby_gc_params_t gc_params = { https://github.com/ruby/ruby/blob/trunk/gc.c#L393 #define GC_DEBUG 0 #endif -#if USE_RGENGC /* RGENGC_DEBUG: * 1: basic information * 2: remember set operation @@ -466,22 +465,6 @@ int ruby_rgengc_debug; https://github.com/ruby/ruby/blob/trunk/gc.c#L465 #define RGENGC_FORCE_MAJOR_GC 0 #endif -#else /* USE_RGENGC */ - -#ifdef RGENGC_DEBUG -#undef RGENGC_DEBUG -#endif -#define RGENGC_DEBUG 0 -#ifdef RGENGC_CHECK_MODE -#undef RGENGC_CHECK_MODE -#endif -#define RGENGC_CHECK_MODE 0 -#define RGENGC_PROFILE 0 -#define RGENGC_ESTIMATE_OLDMALLOC 0 -#define RGENGC_FORCE_MAJOR_GC 0 - -#endif /* USE_RGENGC */ - #ifndef GC_PROFILE_MORE_DETAIL #define GC_PROFILE_MORE_DETAIL 0 #endif @@ -726,9 +709,7 @@ typedef struct rb_objspace { https://github.com/ruby/ruby/blob/trunk/gc.c#L709 unsigned int during_compacting : 1; unsigned int gc_stressful: 1; unsigned int has_hook: 1; -#if USE_RGENGC unsigned int during_minor_gc : 1; -#endif #if GC_ENABLE_INCREMENTAL_MARK unsigned int during_incremental_marking : 1; #endif @@ -781,7 +762,6 @@ typedef struct rb_objspace { https://github.com/ruby/ruby/blob/trunk/gc.c#L762 #endif double invoke_time; -#if USE_RGENGC size_t minor_gc_count; size_t major_gc_count; size_t compact_count; @@ -802,7 +782,6 @@ typedef struct rb_objspace { https://github.com/ruby/ruby/blob/trunk/gc.c#L782 size_t remembered_shady_object_count_types[RUBY_T_MASK]; #endif #endif /* RGENGC_PROFILE */ -#endif /* USE_RGENGC */ /* temporary profiling space */ double gc_sweep_start_time; @@ -819,7 +798,6 @@ typedef struct rb_objspace { https://github.com/ruby/ruby/blob/trunk/gc.c#L798 VALUE gc_stress_mode; -#if USE_RGENGC struct { VALUE parent_object; int need_major_gc; @@ -851,7 +829,6 @@ typedef struct rb_objspace { https://github.com/ruby/ruby/blob/trunk/gc.c#L829 size_t step_slots; } rincgc; #endif -#endif /* USE_RGENGC */ st_table *id_to_obj_tbl; st_table *obj_to_id_tbl; @@ -873,7 +850,7 @@ enum { https://github.com/ruby/ruby/blob/trunk/gc.c#L850 HEAP_PAGE_OBJ_LIMIT = (unsigned int)((HEAP_PAGE_SIZE - sizeof(struct heap_page_header))/sizeof(struct RVALUE)), HEAP_PAGE_BITMAP_LIMIT = CEILDIV(CEILDIV(HEAP_PAGE_SIZE, sizeof(struct RVALUE)), BITS_BITLENGTH), HEAP_PAGE_BITMAP_SIZE = (BITS_SIZE * HEAP_PAGE_BITMAP_LIMIT), - HEAP_PAGE_BITMAP_PLANES = USE_RGENGC ? 4 : 1 /* RGENGC: mark, unprotected, uncollectible, marking */ + HEAP_PAGE_BITMAP_PLANES = 4 /* RGENGC: mark, unprotected, uncollectible, marking */ }; struct heap_page { @@ -893,15 +870,11 @@ struct heap_page { https://github.com/ruby/ruby/blob/trunk/gc.c#L870 RVALUE *freelist; struct list_node page_node; -#if USE_RGENGC bits_t wb_unprotected_bits[HEAP_PAGE_BITMAP_LIMIT]; -#endif /* the following three bitmaps are cleared at the beginning of full GC */ bits_t mark_bits[HEAP_PAGE_BITMAP_LIMIT]; -#if USE_RGENGC bits_t uncollectible_bits[HEAP_PAGE_BITMAP_LIMIT]; bits_t marking_bits[HEAP_PAGE_BITMAP_LIMIT]; -#endif /* If set, the object is not movable */ bits_t pinned_bits[HEAP_PAGE_BITMAP_LIMIT]; @@ -924,11 +897,9 @@ struct heap_page { https://github.com/ruby/ruby/blob/trunk/gc.c#L897 /* getting bitmap */ #define GET_HEAP_MARK_BITS(x) (&GET_HEAP_PAGE(x)->mark_bits[0]) #define GET_HEAP_PINNED_BITS(x) (&GET_HEAP_PAGE(x)->pinned_bits[0]) -#if USE_RGENGC #define GET_HEAP_UNCOLLECTIBLE_BITS(x) (&GET_HEAP_PAGE(x)->uncollectible_bits[0]) #define GET_HEAP_WB_UNPROTECTED_BITS(x) (&GET_HEAP_PAGE(x)->wb_unprotected_bits[0]) #define GET_HEAP_MARKING_BITS(x) (&GET_HEAP_PAGE(x)->marking_bits[0]) -#endif /* Aliases */ #define rb_objspace (*rb_objspace_of(GET_VM())) @@ -986,11 +957,7 @@ gc_mode_verify(enum gc_mode mode) https://github.com/ruby/ruby/blob/trunk/gc.c#L957 #define is_marking(objspace) (gc_mode(objspace) == gc_mode_marking) #define is_sweeping(objspace) (gc_mode(objspace) == gc_mode_sweeping) -#if USE_RGENGC #define is_full_marking(objspace) ((objspace)->flags.during_minor_gc == FALSE) -#else -#define is_full_marking(objspace) TRUE -#endif #if GC_ENABLE_INCREMENTAL_MARK #define is_incremental_marking(objspace) ((objspace)->flags.during_incremental_marking != FALSE) #else @@ -1245,7 +1212,6 @@ tick(void) https://github.com/ruby/ruby/blob/trunk/gc.c#L1212 #define RVALUE_PIN_BITMAP(obj) MARKED_IN_BITMAP(GET_HEAP_PINNED_BITS(obj), (obj)) #define RVALUE_PAGE_MARKED(page, obj) MARKED_IN_BITMAP((page)->mark_bits, (obj)) -#if USE_RGENGC #define RVALUE_WB_UNPROTECTED_BITMAP(obj) MARKED_IN_BITMAP(GET_HEAP_WB_UNPROTECTED_BITS(obj), (obj)) #define RVALUE_UNCOLLECTIBLE_BITMAP(obj) MARKED_IN_BITMAP(GET_HEAP_UNCOLLECTIBLE_BITS(obj), (obj)) #define RVALUE_MARKING_BITMAP(obj) MARKED_IN_BITMAP(GET_HEAP_MARKING_BITS(obj), (obj)) @@ -1269,8 +1235,6 @@ RVALUE_FLAGS_AGE(VALUE flags) https://github.com/ruby/ruby/blob/trunk/gc.c#L1235 return (int)((flags & (FL_PROMOTED0 | FL_PROMOTED1)) >> RVALUE_AGE_SHIFT); } -#endif /* USE_RGENGC */ - static int check_rvalue_consistency_force(const VALUE obj, int terminate) { @@ -1418,7 +1382,6 @@ RVALUE_PINNED(VALUE obj) https://github.com/ruby/ruby/blob/trunk/gc.c#L1382 return RVALUE_PIN_BITMAP(obj) != 0; } -#if USE_RGENGC static inline int RVALUE_WB_UNPROTECTED(VALUE obj) { @@ -1605,8 +1568,6 @@ RVALUE_WHITE_P(VALUE obj) https://github.com/ruby/ruby/blob/trunk/gc.c#L1568 return RVALUE_MARKED(obj) == FALSE; } -#endif /* USE_RGENGC */ - /* --------------------------- ObjectSpace ----------------------------- */ @@ -2180,11 +2141,9 @@ newobj_init(VALUE klass, VALUE flags, VALUE v1, VALUE v2, VALUE v3, int wb_prote https://github.com/ruby/ruby/blob/trunk/gc.c#L2141 if (rgengc_remembered(objspace, (VALUE)obj)) rb_bug("newobj: %s is remembered.", obj_info(obj)); #endif -#if USE_RGENGC if (UNLIKELY(wb_protected == FALSE)) { MARK_IN_BITMAP(GET_HEAP_WB_UNPROTECTED_BITS(obj), obj); } -#endif #if RGENGC_PROFILE if (wb_protected) { @@ -2700,7 +2659,6 @@ obj_free(rb_objspace_t *objspace, VALUE obj) https://github.com/ruby/ruby/blob/trunk/gc.c#L2659 obj_free_object_id(objspace, obj); } -#if USE_RGENGC if (RVALUE_WB_UNPROTECTED(obj)) CLEAR_IN_BITMAP(GET_HEAP_WB_UNPROTECTED_BITS(obj), obj); #if RGENGC_CHECK_MODE @@ -2711,7 +2669,6 @@ obj_free(rb_objspace_t *objspace, VALUE obj) https://github.com/ruby/ruby/blob/trunk/gc.c#L2669 CHECK(RVALUE_UNCOLLECTIBLE); #undef CHECK #endif -#endif switch (BUILTIN_TYPE(obj)) { case T_OBJECT: @@ -4256,13 +4213,8 @@ objspace_free_slots(rb_objspace_t *objspace) https://github.com/ruby/ruby/blob/trunk/gc.c#L4213 static void gc_setup_mark_bits(struct heap_page *page) { -#if USE_RGENGC /* copy oldgen bitmap to mark bitmap */ memcpy(&page->mark_bits[0], &page->uncollectible_bits[0], HEAP_PAGE_BITMAP_SIZE); -#else - /* clear mark bitmap */ - memset(&page->mark_bits[0], 0, HEAP_PAGE_BITMAP_SIZE); -#endif } static inline int @@ -4295,7 +4247,7 @@ gc_page_sweep(rb_objspace_t *objspace, rb_heap_t *heap, struct heap_page *sweep_ https://github.com/ruby/ruby/blob/trunk/gc.c#L4247 switch (BUILTIN_TYPE(p)) { default: { /* majority case */ gc_report(2, objspace, "page_sweep: free %p\n", (void *)p); -#if USE_RGENGC && RGENGC_CHECK_MODE +#if RGENGC_CHECK_MODE if (!is_full_marking(objspace)) { if (RVALUE_OLD_P((VALUE)p)) rb_bug("page_sweep: %p - old while minor GC.", (void *)p); if (rgengc_remembered_sweep(objspace, (VALUE)p)) rb_bug("page_sweep: %p - remembered.", (void *)p); @@ -4535,11 +4487,9 @@ gc_sweep_continue(rb_objspace_t *objspace, rb_heap_t *heap) https://github.com/ruby/ruby/blob/trunk/gc.c#L4487 if (!GC_ENABLE_LAZY_SWEEP) return; gc_enter(objspace, "sweep_continue"); -#if USE_RGENGC if (objspace->rgengc.need_major_gc == GPR_FLAG_NONE && heap_increment(objspace, heap)) { gc_report(3, objspace, "gc_sweep_continue: success heap_increment().\n"); } -#endif gc_sweep_step(objspace, heap); gc_exit(objspace, "sweep_continue"); } @@ -5206,7 +5156,6 @@ gc_mark_set(rb_objspace_t *objspace, VALUE obj) https://github.com/ruby/ruby/blob/trunk/gc.c#L5156 return 1; } -#if USE_RGENGC static int gc_remember_unprotected(rb_objspace_t *objspace, VALUE obj) { @@ -5230,12 +5179,10 @@ gc_remember_unprotected(rb_objspace_t *objspace, VALUE obj) https://github.com/ruby/ruby/blob/trunk/gc.c#L5179 return FALSE; } } -#endif static void rgengc_check_relation(rb_objspace_t *objspace, VALUE obj) { -#if USE_RGENGC const VALUE old_parent = objspace->rgengc.parent_object; if (old_parent) { /* parent object is old */ @@ -5268,7 +5215,6 @@ rgengc_check_relation(rb_objspace_t *objspace, VALUE obj) https://github.com/ruby/ruby/blob/trunk/gc.c#L5215 } GC_ASSERT(old_parent == objspace->rgengc.parent_object); -#endif } static void @@ -5291,7 +5237,6 @@ gc_grey(rb_objspace_t *objspace, VALUE obj) https://github.com/ruby/ruby/blob/trunk/gc.c#L5237 static void gc_aging(rb_objspace_t *objspace, VALUE obj) { -#if USE_RGENGC struct heap_page *page = GET_HEAP_PAGE(obj); GC_ASSERT(RVALUE_MARKING(obj) == FALSE); @@ -5308,7 +5253,6 @@ gc_aging(rb_objspace_t *objspace, VALUE obj) https://github.co (... truncated) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/