summaryrefslogtreecommitdiff
path: root/mjit_worker.c
diff options
context:
space:
mode:
authork0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-03-29 14:08:51 +0000
committerk0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-03-29 14:08:51 +0000
commit5ee256da687f080f8ec0b12c10fc2592020e4872 (patch)
treef4117e13c300f9353a0915e12a255382af9f0876 /mjit_worker.c
parentb03c11a337c53c219a840eed4569e411289f0ddd (diff)
Prevent mjit length counters from being 0
It seems that `debug_counter_show_results_at_exit` could be called earlier than `mjit_finish` sometimes. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67380 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'mjit_worker.c')
-rw-r--r--mjit_worker.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/mjit_worker.c b/mjit_worker.c
index 5c1f24b..51acac3 100644
--- a/mjit_worker.c
+++ b/mjit_worker.c
@@ -327,6 +327,10 @@ mjit_warning(const char *format, ...)
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, struct rb_mjit_unit_list *list)
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--;
}