ruby-changes:55172
From: k0kubun <ko1@a...>
Date: Fri, 29 Mar 2019 22:54:35 +0900 (JST)
Subject: [ruby-changes:55172] k0kubun:r67379 (trunk): Add debug counters for MJIT cancel
k0kubun 2019-03-29 22:54:29 +0900 (Fri, 29 Mar 2019) New Revision: 67379 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=67379 Log: Add debug counters for MJIT cancel Modified files: trunk/debug_counter.c trunk/debug_counter.h trunk/mjit_compile.c trunk/tool/ruby_vm/views/_mjit_compile_insn.erb trunk/tool/ruby_vm/views/_mjit_compile_insn_body.erb trunk/tool/ruby_vm/views/_mjit_compile_ivar.erb trunk/tool/ruby_vm/views/_mjit_compile_send.erb Index: debug_counter.c =================================================================== --- debug_counter.c (revision 67378) +++ debug_counter.c (revision 67379) @@ -21,7 +21,9 @@ static const char *const debug_counter_n https://github.com/ruby/ruby/blob/trunk/debug_counter.c#L21 #undef RB_DEBUG_COUNTER }; +MJIT_SYMBOL_EXPORT_BEGIN size_t rb_debug_counter[numberof(debug_counter_names)]; +MJIT_SYMBOL_EXPORT_END void rb_debug_counter_show_results(const char *msg) Index: debug_counter.h =================================================================== --- debug_counter.h (revision 67378) +++ debug_counter.h (revision 67379) @@ -257,11 +257,18 @@ RB_DEBUG_COUNTER(theap_evacuate) https://github.com/ruby/ruby/blob/trunk/debug_counter.h#L257 /* mjit_exec() counts */ RB_DEBUG_COUNTER(mjit_exec) -RB_DEBUG_COUNTER(mjit_exec_call_func) 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 cancel counters */ +RB_DEBUG_COUNTER(mjit_cancel) +RB_DEBUG_COUNTER(mjit_cancel_ivar) +RB_DEBUG_COUNTER(mjit_cancel_send_inline) +RB_DEBUG_COUNTER(mjit_cancel_opt_insn) /* CALL_SIMPLE_METHOD */ +RB_DEBUG_COUNTER(mjit_cancel_trace) /* rb_mjit_unit_list length */ RB_DEBUG_COUNTER(mjit_length_unit_queue) Index: tool/ruby_vm/views/_mjit_compile_insn_body.erb =================================================================== --- tool/ruby_vm/views/_mjit_compile_insn_body.erb (revision 67378) +++ tool/ruby_vm/views/_mjit_compile_insn_body.erb (revision 67379) @@ -79,6 +79,7 @@ https://github.com/ruby/ruby/blob/trunk/tool/ruby_vm/views/_mjit_compile_insn_body.erb#L79 fprintf(f, " reg_cfp->sp = vm_base_ptr(reg_cfp) + %d;\n", b->stack_size); } fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", pos); + fprintf(f, " RB_DEBUG_COUNTER_INC(mjit_cancel_opt_insn);\n"); fprintf(f, " goto cancel;\n"); % else % if insn.handles_sp? Index: tool/ruby_vm/views/_mjit_compile_send.erb =================================================================== --- tool/ruby_vm/views/_mjit_compile_send.erb (revision 67378) +++ tool/ruby_vm/views/_mjit_compile_send.erb (revision 67379) @@ -38,6 +38,7 @@ https://github.com/ruby/ruby/blob/trunk/tool/ruby_vm/views/_mjit_compile_send.erb#L38 fprintf(f, " RCLASS_SERIAL(CLASS_OF(stack[%d])) != %"PRI_SERIALT_PREFIX"u)) {\n", b->stack_size - 1 - argc, cc_copy->class_serial); fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", pos); fprintf(f, " reg_cfp->sp = vm_base_ptr(reg_cfp) + %d;\n", b->stack_size); + fprintf(f, " RB_DEBUG_COUNTER_INC(mjit_cancel_send_inline);\n"); fprintf(f, " goto cancel;\n"); fprintf(f, " }\n"); @@ -81,6 +82,7 @@ https://github.com/ruby/ruby/blob/trunk/tool/ruby_vm/views/_mjit_compile_send.erb#L82 if (!pc_moved_p) { fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); } + fprintf(f, " RB_DEBUG_COUNTER_INC(mjit_cancel_trace);\n"); fprintf(f, " goto cancel;\n"); fprintf(f, " }\n"); Index: tool/ruby_vm/views/_mjit_compile_ivar.erb =================================================================== --- tool/ruby_vm/views/_mjit_compile_ivar.erb (revision 67378) +++ tool/ruby_vm/views/_mjit_compile_ivar.erb (revision 67379) @@ -42,6 +42,7 @@ https://github.com/ruby/ruby/blob/trunk/tool/ruby_vm/views/_mjit_compile_ivar.erb#L42 fprintf(f, " else {\n"); fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", pos); fprintf(f, " reg_cfp->sp = vm_base_ptr(reg_cfp) + %d;\n", b->stack_size); + fprintf(f, " RB_DEBUG_COUNTER_INC(mjit_cancel_ivar);\n"); fprintf(f, " goto cancel;\n"); fprintf(f, " }\n"); Index: tool/ruby_vm/views/_mjit_compile_insn.erb =================================================================== --- tool/ruby_vm/views/_mjit_compile_insn.erb (revision 67378) +++ tool/ruby_vm/views/_mjit_compile_insn.erb (revision 67379) @@ -66,6 +66,7 @@ https://github.com/ruby/ruby/blob/trunk/tool/ruby_vm/views/_mjit_compile_insn.erb#L66 if (!pc_moved_p) { fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", next_pos); } + fprintf(f, " RB_DEBUG_COUNTER_INC(mjit_cancel_trace);\n"); fprintf(f, " goto cancel;\n"); fprintf(f, " }\n"); % end Index: mjit_compile.c =================================================================== --- mjit_compile.c (revision 67378) +++ mjit_compile.c (revision 67379) @@ -189,6 +189,7 @@ compile_cancel_handler(FILE *f, const st https://github.com/ruby/ruby/blob/trunk/mjit_compile.c#L189 { unsigned int i; fprintf(f, "\ncancel:\n"); + fprintf(f, " RB_DEBUG_COUNTER_INC(mjit_cancel);\n"); if (status->local_stack_p) { for (i = 0; i < body->stack_max; i++) { fprintf(f, " *(vm_base_ptr(reg_cfp) + %d) = stack[%d];\n", i, i); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/