ruby-changes:55431
From: tenderlove <ko1@a...>
Date: Sat, 20 Apr 2019 15:09:01 +0900 (JST)
Subject: [ruby-changes:55431] tenderlove:r67640 (trunk): Make sure the has_remembered_objects flag is correctly set
tenderlove 2019-04-20 15:08:54 +0900 (Sat, 20 Apr 2019) New Revision: 67640 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=67640 Log: Make sure the has_remembered_objects flag is correctly set Remembered objects can move between pages, so we need to make sure the flags on the page are set correctly. Modified files: trunk/gc.c Index: gc.c =================================================================== --- gc.c (revision 67639) +++ gc.c (revision 67640) @@ -4655,10 +4655,6 @@ gc_mark_maybe_(rb_objspace_t *objspace, https://github.com/ruby/ruby/blob/trunk/gc.c#L4655 unpoison_object(obj, false); type = BUILTIN_TYPE(obj); - if (type == T_MOVED || type == T_ZOMBIE) { - gc_pin(objspace, obj); - } - /* Garbage can live on the stack, so do not mark or pin */ if (type != T_MOVED && type != T_ZOMBIE && type != T_NONE) { if (pin) { @@ -7984,6 +7980,7 @@ gc_ref_update(void *vstart, void *vend, https://github.com/ruby/ruby/blob/trunk/gc.c#L7980 page->freelist = NULL; poison_memory_region(&page->freelist, sizeof(RVALUE*)); page->flags.has_uncollectible_shady_objects = FALSE; + page->flags.has_remembered_objects = FALSE; /* For each object on the page */ for (; v != (VALUE)vend; v += stride) { @@ -7998,6 +7995,9 @@ gc_ref_update(void *vstart, void *vend, https://github.com/ruby/ruby/blob/trunk/gc.c#L7995 if (RVALUE_WB_UNPROTECTED(v)) { page->flags.has_uncollectible_shady_objects = TRUE; } + if (RVALUE_PAGE_MARKING(page, v)) { + page->flags.has_remembered_objects = TRUE; + } gc_update_object_references(objspace, v); } } @@ -8145,6 +8145,7 @@ gc_verify_compaction_references(VALUE mo https://github.com/ruby/ruby/blob/trunk/gc.c#L8145 /* Ensure objects are pinned */ rb_gc(); + rb_gc_disable(); gc_compact_heap(objspace); @@ -8157,6 +8158,8 @@ gc_verify_compaction_references(VALUE mo https://github.com/ruby/ruby/blob/trunk/gc.c#L8158 heap_eden->free_pages = NULL; heap_eden->using_page = NULL; + gc_verify_internal_consistency(mod); + rb_gc_enable(); /* GC after compaction to eliminate T_MOVED */ rb_gc(); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/