ruby-changes:56993
From: Nobuyoshi <ko1@a...>
Date: Tue, 13 Aug 2019 09:50:39 +0900 (JST)
Subject: [ruby-changes:56993] Nobuyoshi Nakada: 917d766508 (master): Move rb_objspace_t* in gc_verify_internal_consistency to an argument
https://git.ruby-lang.org/ruby.git/commit/?id=917d766508 From 917d766508707ebf894244fe4624b064315a7ad7 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Mon, 12 Aug 2019 22:33:46 +0900 Subject: Move rb_objspace_t* in gc_verify_internal_consistency to an argument diff --git a/gc.c b/gc.c index e666e61..1d70355 100644 --- a/gc.c +++ b/gc.c @@ -896,7 +896,7 @@ static size_t mark_stack_size(mark_stack_t *stack); https://github.com/ruby/ruby/blob/trunk/gc.c#L896 static void shrink_stack_chunk_cache(mark_stack_t *stack); static size_t obj_memsize_of(VALUE obj, int use_all_types); -static VALUE gc_verify_internal_consistency(VALUE self); +static void gc_verify_internal_consistency(rb_objspace_t *objspace); static int gc_verify_heap_page(rb_objspace_t *objspace, struct heap_page *page, VALUE obj); static int gc_verify_heap_pages(rb_objspace_t *objspace); @@ -3236,7 +3236,7 @@ rb_objspace_call_finalizer(rb_objspace_t *objspace) https://github.com/ruby/ruby/blob/trunk/gc.c#L3236 size_t i; #if RGENGC_CHECK_MODE >= 2 - gc_verify_internal_consistency(Qnil); + gc_verify_internal_consistency(objspace); #endif gc_rest(objspace); @@ -4082,7 +4082,7 @@ gc_sweep_finish(rb_objspace_t *objspace) https://github.com/ruby/ruby/blob/trunk/gc.c#L4082 gc_mode_transition(objspace, gc_mode_none); #if RGENGC_CHECK_MODE >= 2 - gc_verify_internal_consistency(Qnil); + gc_verify_internal_consistency(objspace); #endif } @@ -5294,7 +5294,7 @@ gc_mark_stacked_objects(rb_objspace_t *objspace, int incremental, size_t count) https://github.com/ruby/ruby/blob/trunk/gc.c#L5294 #endif } - if (RGENGC_CHECK_MODE >= 3) gc_verify_internal_consistency(Qnil); + if (RGENGC_CHECK_MODE >= 3) gc_verify_internal_consistency(objspace); if (is_mark_stack_empty(mstack)) { shrink_stack_chunk_cache(mstack); @@ -5889,9 +5889,16 @@ gc_verify_heap_pages(rb_objspace_t *objspace) https://github.com/ruby/ruby/blob/trunk/gc.c#L5889 * if RGenGC is supported. */ static VALUE -gc_verify_internal_consistency(VALUE dummy) +gc_verify_internal_consistency_m(VALUE dummy) +{ + gc_verify_internal_consistency(&rb_objspace); + + return Qnil; +} + +static void +gc_verify_internal_consistency(rb_objspace_t *objspace) { - rb_objspace_t *objspace = &rb_objspace; struct verify_internal_consistency_struct data = {0}; struct each_obj_args eo_args; @@ -5962,14 +5969,12 @@ gc_verify_internal_consistency(VALUE dummy) https://github.com/ruby/ruby/blob/trunk/gc.c#L5969 } gc_report(5, objspace, "gc_verify_internal_consistency: OK\n"); - - return Qnil; } void rb_gc_verify_internal_consistency(void) { - gc_verify_internal_consistency(Qnil); + gc_verify_internal_consistency(&rb_objspace); } static VALUE @@ -6105,7 +6110,7 @@ gc_marks_finish(rb_objspace_t *objspace) https://github.com/ruby/ruby/blob/trunk/gc.c#L6110 #endif /* GC_ENABLE_INCREMENTAL_MARK */ #if RGENGC_CHECK_MODE >= 2 - gc_verify_internal_consistency(Qnil); + gc_verify_internal_consistency(objspace); #endif #if USE_RGENGC @@ -7018,7 +7023,7 @@ gc_start(rb_objspace_t *objspace, int reason) https://github.com/ruby/ruby/blob/trunk/gc.c#L7023 GC_ASSERT(!is_lazy_sweeping(heap_eden)); GC_ASSERT(!is_incremental_marking(objspace)); #if RGENGC_CHECK_MODE >= 2 - gc_verify_internal_consistency(Qnil); + gc_verify_internal_consistency(objspace); #endif gc_enter(objspace, "gc_start"); @@ -7121,7 +7126,7 @@ gc_rest(rb_objspace_t *objspace) https://github.com/ruby/ruby/blob/trunk/gc.c#L7126 if (marking || sweeping) { gc_enter(objspace, "gc_rest"); - if (RGENGC_CHECK_MODE >= 2) gc_verify_internal_consistency(Qnil); + if (RGENGC_CHECK_MODE >= 2) gc_verify_internal_consistency(objspace); if (is_incremental_marking(objspace)) { PUSH_MARK_FUNC_DATA(NULL); @@ -7222,7 +7227,7 @@ static inline void https://github.com/ruby/ruby/blob/trunk/gc.c#L7227 gc_enter(rb_objspace_t *objspace, const char *event) { GC_ASSERT(during_gc == 0); - if (RGENGC_CHECK_MODE >= 3) gc_verify_internal_consistency(Qnil); + if (RGENGC_CHECK_MODE >= 3) gc_verify_internal_consistency(objspace); mjit_gc_start_hook(); @@ -8343,7 +8348,7 @@ gc_compact_after_gc(rb_objspace_t *objspace, int use_toward_empty, int use_doubl https://github.com/ruby/ruby/blob/trunk/gc.c#L8348 mjit_gc_start_hook(); // prevent MJIT from running while moving pointers related to ISeq if (use_verifier) { - gc_verify_internal_consistency(Qnil); + gc_verify_internal_consistency(objspace); } if (use_double_pages) { @@ -8375,7 +8380,7 @@ gc_compact_after_gc(rb_objspace_t *objspace, int use_toward_empty, int use_doubl https://github.com/ruby/ruby/blob/trunk/gc.c#L8380 heap_eden->using_page = NULL; if (use_verifier) { - gc_verify_internal_consistency(Qnil); + gc_verify_internal_consistency(objspace); } #if __has_feature(address_sanitizer) @@ -11691,7 +11696,7 @@ Init_GC(void) https://github.com/ruby/ruby/blob/trunk/gc.c#L11696 } /* internal methods */ - rb_define_singleton_method(rb_mGC, "verify_internal_consistency", gc_verify_internal_consistency, 0); + rb_define_singleton_method(rb_mGC, "verify_internal_consistency", gc_verify_internal_consistency_m, 0); rb_define_singleton_method(rb_mGC, "verify_compaction_references", gc_verify_compaction_references, -1); rb_define_singleton_method(rb_mGC, "verify_transient_heap_internal_consistency", gc_verify_transient_heap_internal_consistency, 0); #if MALLOC_ALLOCATED_SIZE -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/