From 5a6b0e39a1913235d960fafb37b23a29317ccd11 Mon Sep 17 00:00:00 2001 From: k0kubun Date: Sat, 6 Apr 2019 14:42:02 +0000 Subject: [PATCH] Add debug counter for VM <-> MJIT calls git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67460 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- debug_counter.h | 6 ++++++ mjit.h | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/debug_counter.h b/debug_counter.h index f0de6d2cb6..b28efb3278 100644 --- a/debug_counter.h +++ b/debug_counter.h @@ -263,6 +263,12 @@ RB_DEBUG_COUNTER(mjit_exec_not_ready) RB_DEBUG_COUNTER(mjit_exec_not_compiled) RB_DEBUG_COUNTER(mjit_exec_call_func) +/* MJIT <-> VM frame push counts */ +RB_DEBUG_COUNTER(mjit_frame_VM2VM) +RB_DEBUG_COUNTER(mjit_frame_VM2JT) +RB_DEBUG_COUNTER(mjit_frame_JT2JT) +RB_DEBUG_COUNTER(mjit_frame_JT2VM) + /* MJIT cancel counters */ RB_DEBUG_COUNTER(mjit_cancel) RB_DEBUG_COUNTER(mjit_cancel_ivar) diff --git a/mjit.h b/mjit.h index 4b4d7cce47..6fb15b402c 100644 --- a/mjit.h +++ b/mjit.h @@ -110,6 +110,11 @@ mjit_exec(rb_execution_context_t *ec) func = body->jit_func; if (UNLIKELY((uintptr_t)func <= (uintptr_t)LAST_JIT_ISEQ_FUNC)) { +# ifdef MJIT_HEADER + RB_DEBUG_COUNTER_INC(mjit_frame_JT2VM); +# else + RB_DEBUG_COUNTER_INC(mjit_frame_VM2VM); +# endif switch ((enum rb_mjit_iseq_func)func) { case NOT_ADDED_JIT_ISEQ_FUNC: RB_DEBUG_COUNTER_INC(mjit_exec_not_added); @@ -132,6 +137,11 @@ mjit_exec(rb_execution_context_t *ec) } } +# ifdef MJIT_HEADER + RB_DEBUG_COUNTER_INC(mjit_frame_JT2JT); +# else + RB_DEBUG_COUNTER_INC(mjit_frame_VM2JT); +# endif RB_DEBUG_COUNTER_INC(mjit_exec_call_func); return func(ec, ec->cfp); }