ruby-changes:55173
From: k0kubun <ko1@a...>
Date: Fri, 29 Mar 2019 23:08:58 +0900 (JST)
Subject: [ruby-changes:55173] k0kubun:r67380 (trunk): Prevent mjit length counters from being 0
k0kubun 2019-03-29 23:08:51 +0900 (Fri, 29 Mar 2019) New Revision: 67380 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=67380 Log: Prevent mjit length counters from being 0 It seems that `debug_counter_show_results_at_exit` could be called earlier than `mjit_finish` sometimes. Modified files: trunk/mjit.c trunk/mjit_worker.c Index: mjit_worker.c =================================================================== --- mjit_worker.c (revision 67379) +++ mjit_worker.c (revision 67380) @@ -327,6 +327,10 @@ mjit_warning(const char *format, ...) https://github.com/ruby/ruby/blob/trunk/mjit_worker.c#L327 static void add_to_list(struct rb_mjit_unit *unit, struct rb_mjit_unit_list *list) { + RB_DEBUG_COUNTER_INC_IF(mjit_length_unit_queue, list == &unit_queue); + RB_DEBUG_COUNTER_INC_IF(mjit_length_active_units, list == &active_units); + RB_DEBUG_COUNTER_INC_IF(mjit_length_compact_units, list == &compact_units); + list_add_tail(&list->head, &unit->unode); list->length++; } @@ -334,6 +338,12 @@ add_to_list(struct rb_mjit_unit *unit, s https://github.com/ruby/ruby/blob/trunk/mjit_worker.c#L338 static void remove_from_list(struct rb_mjit_unit *unit, struct rb_mjit_unit_list *list) { +#if USE_DEBUG_COUNTER + rb_debug_counter_add(RB_DEBUG_COUNTER_mjit_length_unit_queue, -1, list == &unit_queue); + rb_debug_counter_add(RB_DEBUG_COUNTER_mjit_length_active_units, -1, list == &active_units); + rb_debug_counter_add(RB_DEBUG_COUNTER_mjit_length_compact_units, -1, list == &compact_units); +#endif + list_del(&unit->unode); list->length--; } Index: mjit.c =================================================================== --- mjit.c (revision 67379) +++ mjit.c (revision 67380) @@ -781,12 +781,6 @@ mjit_finish(bool close_handle_p) https://github.com/ruby/ruby/blob/trunk/mjit.c#L781 if (!mjit_enabled) return; -#if USE_DEBUG_COUNTER - rb_debug_counter_add(RB_DEBUG_COUNTER_mjit_length_unit_queue, unit_queue.length, 1); - rb_debug_counter_add(RB_DEBUG_COUNTER_mjit_length_active_units, active_units.length, 1); - rb_debug_counter_add(RB_DEBUG_COUNTER_mjit_length_compact_units, compact_units.length, 1); -#endif - /* Wait for pch finish */ verbose(2, "Stopping worker thread"); CRITICAL_SECTION_START(3, "in mjit_finish to wakeup from pch"); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/