mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
MJIT: Remove obsoleted MJIT counters
This commit is contained in:
parent
12916e283f
commit
57cb4a8179
5 changed files with 1 additions and 77 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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"
|
||||
|
|
32
mjit.c
32
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);
|
||||
|
||||
|
|
1
mjit.h
1
mjit.h
|
@ -14,7 +14,6 @@
|
|||
|
||||
# if USE_MJIT
|
||||
|
||||
#include "debug_counter.h"
|
||||
#include "ruby.h"
|
||||
#include "vm_core.h"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue