ruby-changes:55373
From: tenderlove <ko1@a...>
Date: Wed, 17 Apr 2019 14:19:11 +0900 (JST)
Subject: [ruby-changes:55373] tenderlove:r67581 (trunk): make verification more strict
tenderlove 2019-04-17 14:19:05 +0900 (Wed, 17 Apr 2019) New Revision: 67581 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=67581 Log: make verification more strict Modified files: trunk/gc.c Index: gc.c =================================================================== --- gc.c (revision 67580) +++ gc.c (revision 67581) @@ -8130,20 +8130,32 @@ gc_check_references_for_moved(VALUE dumm https://github.com/ruby/ruby/blob/trunk/gc.c#L8130 * make a SEGV. */ static VALUE -gc_verify_compaction_references(VALUE dummy) +gc_verify_compaction_references(VALUE mod) { - VALUE stats; rb_objspace_t *objspace = &rb_objspace; - /* Double heap size */ - heap_add_pages(objspace, heap_eden, heap_allocated_pages); + /* Ensure objects are pinned */ + rb_gc(); - stats = rb_gc_compact(dummy); + /* Drain interrupts so that THEAP has a chance to evacuate before + * any possible compaction. */ + rb_thread_execute_interrupts(rb_thread_current()); - gc_check_references_for_moved(dummy); - gc_verify_internal_consistency(dummy); + gc_compact_heap(objspace); - return stats; + heap_eden->freelist = NULL; + gc_update_references(objspace); + gc_check_references_for_moved(mod); + + rb_clear_method_cache_by_class(rb_cObject); + rb_clear_constant_cache(); + heap_eden->free_pages = NULL; + heap_eden->using_page = NULL; + + /* GC after compaction to eliminate T_MOVED */ + rb_gc(); + + return rb_gc_compact_stats(mod); } VALUE -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/