From f6a54e6e461e3689d0d9068d33f986ce2d458bef Mon Sep 17 00:00:00 2001 From: Takashi Kokubun Date: Sun, 15 Mar 2020 00:24:15 -0700 Subject: [PATCH] Add debug counter for unload_units changing add_iseq_to_process's debug counter name as well for comparison --- debug_counter.h | 5 ++++- mjit.c | 2 ++ mjit.h | 1 - 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/debug_counter.h b/debug_counter.h index e38b5c6b79..687179e40e 100644 --- a/debug_counter.h +++ b/debug_counter.h @@ -311,11 +311,14 @@ RB_DEBUG_COUNTER(theap_evacuate) /* mjit_exec() counts */ RB_DEBUG_COUNTER(mjit_exec) RB_DEBUG_COUNTER(mjit_exec_not_added) -RB_DEBUG_COUNTER(mjit_exec_not_added_add_iseq) RB_DEBUG_COUNTER(mjit_exec_not_ready) RB_DEBUG_COUNTER(mjit_exec_not_compiled) RB_DEBUG_COUNTER(mjit_exec_call_func) +/* MJIT enqueue / unload */ +RB_DEBUG_COUNTER(mjit_add_iseq_to_process) +RB_DEBUG_COUNTER(mjit_unload_units) + /* MJIT <-> VM frame push counts */ RB_DEBUG_COUNTER(mjit_frame_VM2VM) RB_DEBUG_COUNTER(mjit_frame_VM2JT) diff --git a/mjit.c b/mjit.c index b03d92cb77..239325ee89 100644 --- a/mjit.c +++ b/mjit.c @@ -377,6 +377,7 @@ mjit_add_iseq_to_process(const rb_iseq_t *iseq, const struct rb_mjit_compile_inf if (!mjit_enabled || pch_status == PCH_FAILED) return; + RB_DEBUG_COUNTER_INC(mjit_add_iseq_to_process); iseq->body->jit_func = (mjit_func_t)NOT_READY_JIT_ISEQ_FUNC; create_unit(iseq); if (iseq->body->jit_unit == NULL) @@ -388,6 +389,7 @@ mjit_add_iseq_to_process(const rb_iseq_t *iseq, const struct rb_mjit_compile_inf CRITICAL_SECTION_START(3, "in add_iseq_to_process"); add_to_list(iseq->body->jit_unit, &unit_queue); if (active_units.length >= mjit_opts.max_cache_size) { + RB_DEBUG_COUNTER_INC(mjit_unload_units); unload_units(); } verbose(3, "Sending wakeup signal to workers in mjit_add_iseq_to_process"); diff --git a/mjit.h b/mjit.h index dac0bcfc39..c504112488 100644 --- a/mjit.h +++ b/mjit.h @@ -138,7 +138,6 @@ mjit_exec(rb_execution_context_t *ec) case NOT_ADDED_JIT_ISEQ_FUNC: RB_DEBUG_COUNTER_INC(mjit_exec_not_added); if (total_calls == mjit_opts.min_calls && mjit_target_iseq_p(body)) { - RB_DEBUG_COUNTER_INC(mjit_exec_not_added_add_iseq); rb_mjit_add_iseq_to_process(iseq); if (UNLIKELY(mjit_opts.wait)) { return rb_mjit_wait_call(ec, body);