From: Vlad Brezae Date: Wed, 21 Jun 2017 11:09:12 +0000 (+0300) Subject: [sgen] Remove redundant code X-Git-Url: http://wien.tomnetworks.com/gitweb/?p=mono.git;a=commitdiff_plain;h=271c88f8a8a948c5f2fd2f975895f31195906c35 [sgen] Remove redundant code We always init worker distribute gray queue when initialising worker infrastructure. --- diff --git a/mono/sgen/sgen-gc.c b/mono/sgen/sgen-gc.c index 09c626f5732..3d04584377b 100644 --- a/mono/sgen/sgen-gc.c +++ b/mono/sgen/sgen-gc.c @@ -1546,10 +1546,8 @@ workers_finish_callback (void) } static void -init_gray_queue (SgenGrayQueue *gc_thread_gray_queue, gboolean use_workers) +init_gray_queue (SgenGrayQueue *gc_thread_gray_queue) { - if (use_workers) - sgen_workers_init_distribute_gray_queue (); sgen_gray_object_queue_init (gc_thread_gray_queue, NULL, TRUE); } @@ -1700,7 +1698,7 @@ collect_nursery (const char *reason, gboolean is_overflow, SgenGrayQueue *unpin_ sgen_memgov_minor_collection_start (); - init_gray_queue (&gc_thread_gray_queue, is_parallel); + init_gray_queue (&gc_thread_gray_queue); ctx = CONTEXT_FROM_OBJECT_OPERATIONS (object_ops_nopar, &gc_thread_gray_queue); gc_stats.minor_gc_count ++; @@ -2286,7 +2284,7 @@ major_do_collection (const char *reason, gboolean is_overflow, gboolean forced) /* world must be stopped already */ TV_GETTIME (time_start); - init_gray_queue (&gc_thread_gray_queue, FALSE); + init_gray_queue (&gc_thread_gray_queue); major_start_collection (&gc_thread_gray_queue, reason, FALSE, &old_next_pin_slot); major_finish_collection (&gc_thread_gray_queue, reason, is_overflow, old_next_pin_slot, forced); sgen_gray_object_queue_dispose (&gc_thread_gray_queue); @@ -2320,7 +2318,7 @@ major_start_concurrent_collection (const char *reason) binary_protocol_concurrent_start (); - init_gray_queue (&gc_thread_gray_queue, TRUE); + init_gray_queue (&gc_thread_gray_queue); // FIXME: store reason and pass it when finishing major_start_collection (&gc_thread_gray_queue, reason, TRUE, NULL); sgen_gray_object_queue_dispose (&gc_thread_gray_queue); @@ -2388,7 +2386,7 @@ major_finish_concurrent_collection (gboolean forced) current_collection_generation = GENERATION_OLD; sgen_cement_reset (); - init_gray_queue (&gc_thread_gray_queue, FALSE); + init_gray_queue (&gc_thread_gray_queue); major_finish_collection (&gc_thread_gray_queue, "finishing", FALSE, -1, forced); sgen_gray_object_queue_dispose (&gc_thread_gray_queue); diff --git a/mono/sgen/sgen-workers.c b/mono/sgen/sgen-workers.c index 8d3252eb186..c8f16d329d0 100644 --- a/mono/sgen/sgen-workers.c +++ b/mono/sgen/sgen-workers.c @@ -41,7 +41,6 @@ static volatile gboolean workers_finished; static int worker_awakenings; static SgenSectionGrayQueue workers_distribute_gray_queue; -static gboolean workers_distribute_gray_queue_inited; /* * Allowed transitions: @@ -352,23 +351,8 @@ marker_idle_func (void *data_untyped) static void init_distribute_gray_queue (void) { - if (workers_distribute_gray_queue_inited) { - g_assert (sgen_section_gray_queue_is_empty (&workers_distribute_gray_queue)); - g_assert (workers_distribute_gray_queue.locked); - return; - } - sgen_section_gray_queue_init (&workers_distribute_gray_queue, TRUE, sgen_get_major_collector ()->is_concurrent ? concurrent_enqueue_check : NULL); - workers_distribute_gray_queue_inited = TRUE; -} - -void -sgen_workers_init_distribute_gray_queue (void) -{ - SGEN_ASSERT (0, sgen_get_major_collector ()->is_concurrent || sgen_get_minor_collector ()->is_parallel, - "Why should we init the distribute gray queue if we don't need it?"); - init_distribute_gray_queue (); } void