summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Kokubun <[email protected]>2022-12-06 23:01:30 -0800
committerTakashi Kokubun <[email protected]>2022-12-06 23:05:00 -0800
commit57cb4a817916637eaeb4732f56c5aa5b748a4349 (patch)
tree1f1747b3a25c3e50c779ac5f34e3422a9748270c
parent12916e283fdeb87b84f09379c056614c6196615a (diff)
MJIT: Remove obsoleted MJIT counters
-rw-r--r--debug_counter.c12
-rw-r--r--debug_counter.h24
-rw-r--r--lib/mjit/compiler.rb9
-rw-r--r--mjit.c32
-rw-r--r--mjit.h1
5 files changed, 1 insertions, 77 deletions
diff --git a/debug_counter.c b/debug_counter.c
index 0fd0e20c6d..cbaf15d496 100644
--- a/debug_counter.c
+++ b/debug_counter.c
@@ -56,17 +56,7 @@ void
ruby_debug_counter_reset(void)
{
for (int i = 0; i < RB_DEBUG_COUNTER_MAX; i++) {
- switch (i) {
- case RB_DEBUG_COUNTER_mjit_length_unit_queue:
- case RB_DEBUG_COUNTER_mjit_length_active_units:
- case RB_DEBUG_COUNTER_mjit_length_compact_units:
- case RB_DEBUG_COUNTER_mjit_length_stale_units:
- // These counters may be decreased and should not be reset.
- break;
- default:
- rb_debug_counter[i] = 0;
- break;
- }
+ rb_debug_counter[i] = 0;
}
}
diff --git a/debug_counter.h b/debug_counter.h
index a09ef3018d..b0047685f0 100644
--- a/debug_counter.h
+++ b/debug_counter.h
@@ -346,30 +346,6 @@ RB_DEBUG_COUNTER(vm_sync_lock_enter_nb)
RB_DEBUG_COUNTER(vm_sync_lock_enter_cr)
RB_DEBUG_COUNTER(vm_sync_barrier)
-/* 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_inline)
-RB_DEBUG_COUNTER(mjit_cancel_exivar_inline)
-RB_DEBUG_COUNTER(mjit_cancel_send_inline)
-RB_DEBUG_COUNTER(mjit_cancel_opt_insn) /* CALL_SIMPLE_METHOD */
-RB_DEBUG_COUNTER(mjit_cancel_invalidate_all)
-RB_DEBUG_COUNTER(mjit_cancel_leave)
-
-/* rb_mjit_unit_list length */
-RB_DEBUG_COUNTER(mjit_length_unit_queue)
-RB_DEBUG_COUNTER(mjit_length_active_units)
-RB_DEBUG_COUNTER(mjit_length_compact_units)
-RB_DEBUG_COUNTER(mjit_length_stale_units)
-
-/* Other MJIT counters */
-RB_DEBUG_COUNTER(mjit_compile_failures)
-
/* load (not implemented yet) */
/*
RB_DEBUG_COUNTER(load_files)
diff --git a/lib/mjit/compiler.rb b/lib/mjit/compiler.rb
index 59b131ff45..b0c8098e3c 100644
--- a/lib/mjit/compiler.rb
+++ b/lib/mjit/compiler.rb
@@ -315,7 +315,6 @@ class RubyVM::MJIT::Compiler
if !pc_moved_p
src << " reg_cfp->pc = original_body_iseq + #{next_pos};\n"
end
- src << " RB_DEBUG_COUNTER_INC(mjit_cancel_invalidate_all);\n"
src << " goto cancel;\n"
src << " }\n"
end
@@ -496,7 +495,6 @@ class RubyVM::MJIT::Compiler
if !pc_moved_p
src << " reg_cfp->pc = original_body_iseq + #{next_pos};\n"
end
- src << " RB_DEBUG_COUNTER_INC(mjit_cancel_invalidate_all);\n"
src << " goto cancel;\n"
src << " }\n"
end
@@ -529,7 +527,6 @@ class RubyVM::MJIT::Compiler
src << " rb_threadptr_execute_interrupts(rb_ec_thread_ptr(ec), 0);\n"
src << " if (UNLIKELY(!mjit_call_p)) {\n"
src << " reg_cfp->sp = vm_base_ptr(reg_cfp) + #{stack_size};\n"
- src << " RB_DEBUG_COUNTER_INC(mjit_cancel_invalidate_all);\n"
src << " goto cancel;\n"
src << " }\n"
src << " }\n"
@@ -567,7 +564,6 @@ class RubyVM::MJIT::Compiler
src << " reg_cfp->sp = vm_base_ptr(reg_cfp) + #{stack_size};\n"
end
src << " reg_cfp->pc = original_body_iseq + #{pos};\n"
- src << " RB_DEBUG_COUNTER_INC(mjit_cancel_opt_insn);\n"
src << " goto cancel;\n"
when /\A(?<prefix>.+\b)INSN_LABEL\((?<name>[^)]+)\)(?<suffix>.+)\z/m
prefix, name, suffix = Regexp.last_match[:prefix], Regexp.last_match[:name], Regexp.last_match[:suffix]
@@ -636,7 +632,6 @@ class RubyVM::MJIT::Compiler
# Print the block to cancel inlined method call. It's supporting only `opt_send_without_block` for now.
def compile_inlined_cancel_handler(src, body, inline_context)
src << "\ncancel:\n"
- src << " RB_DEBUG_COUNTER_INC(mjit_cancel);\n"
src << " rb_mjit_recompile_inlining(original_iseq);\n"
# Swap pc/sp set on cancel with original pc/sp.
@@ -674,17 +669,14 @@ class RubyVM::MJIT::Compiler
end
src << "\nsend_cancel:\n"
- src << " RB_DEBUG_COUNTER_INC(mjit_cancel_send_inline);\n"
src << " rb_mjit_recompile_send(original_iseq);\n"
src << " goto cancel;\n"
src << "\nivar_cancel:\n"
- src << " RB_DEBUG_COUNTER_INC(mjit_cancel_ivar_inline);\n"
src << " rb_mjit_recompile_ivar(original_iseq);\n"
src << " goto cancel;\n"
src << "\nexivar_cancel:\n"
- src << " RB_DEBUG_COUNTER_INC(mjit_cancel_exivar_inline);\n"
src << " rb_mjit_recompile_exivar(original_iseq);\n"
src << " goto cancel;\n"
@@ -693,7 +685,6 @@ class RubyVM::MJIT::Compiler
src << " goto cancel;\n"
src << "\ncancel:\n"
- src << " RB_DEBUG_COUNTER_INC(mjit_cancel);\n"
if status.local_stack_p
(0...body.stack_max).each do |i|
src << " *(vm_base_ptr(reg_cfp) + #{i}) = stack[#{i}];\n"
diff --git a/mjit.c b/mjit.c
index 2352c8d34e..0a9582a7cf 100644
--- a/mjit.c
+++ b/mjit.c
@@ -306,11 +306,6 @@ mjit_warning(const char *format, ...)
static void
add_to_list(struct rb_mjit_unit *unit, struct rb_mjit_unit_list *list)
{
- (void)RB_DEBUG_COUNTER_INC_IF(mjit_length_unit_queue, list == &unit_queue);
- (void)RB_DEBUG_COUNTER_INC_IF(mjit_length_active_units, list == &active_units);
- (void)RB_DEBUG_COUNTER_INC_IF(mjit_length_compact_units, list == &compact_units);
- (void)RB_DEBUG_COUNTER_INC_IF(mjit_length_stale_units, list == &stale_units);
-
ccan_list_add_tail(&list->head, &unit->unode);
list->length++;
}
@@ -318,13 +313,6 @@ 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);
- rb_debug_counter_add(RB_DEBUG_COUNTER_mjit_length_stale_units, -1, list == &stale_units);
-#endif
-
ccan_list_del(&unit->unode);
list->length--;
}
@@ -1906,22 +1894,6 @@ mjit_child_after_fork(void)
start_worker();
}
-// Edit 0 to 1 to enable this feature for investigating hot methods
-#define MJIT_COUNTER 0
-#if MJIT_COUNTER
-static void
-mjit_dump_total_calls(void)
-{
- struct rb_mjit_unit *unit;
- fprintf(stderr, "[MJIT_COUNTER] total_calls of active_units:\n");
- ccan_list_for_each(&active_units.head, unit, unode) {
- const rb_iseq_t *iseq = unit->iseq;
- fprintf(stderr, "%8ld: %s@%s:%d\n", ISEQ_BODY(iseq)->total_calls, RSTRING_PTR(ISEQ_BODY(iseq)->location.label),
- RSTRING_PTR(rb_iseq_path(iseq)), ISEQ_BODY(iseq)->location.first_lineno);
- }
-}
-#endif
-
// Finish the threads processing units and creating PCH, finalize
// and free MJIT data. It should be called last during MJIT
// life.
@@ -1944,10 +1916,6 @@ mjit_finish(bool close_handle_p)
rb_native_cond_destroy(&mjit_worker_wakeup);
rb_native_cond_destroy(&mjit_gc_wakeup);
-#if MJIT_COUNTER
- mjit_dump_total_calls();
-#endif
-
if (!mjit_opts.save_temps && getpid() == pch_owner_pid && pch_status == PCH_SUCCESS && !mjit_opts.custom)
remove_file(pch_file);
diff --git a/mjit.h b/mjit.h
index 568f65d1e7..d5c5858d6f 100644
--- a/mjit.h
+++ b/mjit.h
@@ -14,7 +14,6 @@
# if USE_MJIT
-#include "debug_counter.h"
#include "ruby.h"
#include "vm_core.h"