From d45118aaafe4e1e8409c13dea462fbbaf8b4cb8c Mon Sep 17 00:00:00 2001 From: Takashi Kokubun Date: Tue, 11 Jul 2023 14:35:22 -0700 Subject: [PATCH] Remove obsoleted USE_INSNS_COUNTER macro for now I don't use that these days. I'd like to remove this to ease a change I'm writing. I'll resurrect this when I need this again. --- vm_exec.c | 31 ------------------------------- vm_exec.h | 7 +------ 2 files changed, 1 insertion(+), 37 deletions(-) diff --git a/vm_exec.c b/vm_exec.c index 36bacfd5e8..441a95db48 100644 --- a/vm_exec.c +++ b/vm_exec.c @@ -15,37 +15,6 @@ static void vm_analysis_insn(int insn); #endif -MAYBE_UNUSED(static void vm_insns_counter_count_insn(int insn)); -#if USE_INSNS_COUNTER -static size_t rb_insns_counter[VM_INSTRUCTION_SIZE]; - -static void -vm_insns_counter_count_insn(int insn) -{ - rb_insns_counter[insn]++; -} - -__attribute__((destructor)) -static void -vm_insns_counter_show_results_at_exit(void) -{ - int insn_end = (ruby_vm_event_enabled_global_flags & ISEQ_TRACE_EVENTS) - ? VM_INSTRUCTION_SIZE : VM_INSTRUCTION_SIZE / 2; - - size_t total = 0; - for (int insn = 0; insn < insn_end; insn++) - total += rb_insns_counter[insn]; - - for (int insn = 0; insn < insn_end; insn++) { - fprintf(stderr, "[RUBY_INSNS_COUNTER]\t%-32s%'12"PRIuSIZE" (%4.1f%%)\n", - insn_name(insn), rb_insns_counter[insn], - 100.0 * rb_insns_counter[insn] / total); - } -} -#else -static void vm_insns_counter_count_insn(int insn) {} -#endif - #if VMDEBUG > 0 #define DECL_SC_REG(type, r, reg) register type reg_##r diff --git a/vm_exec.h b/vm_exec.h index a00bd5027c..dbfd4e9f44 100644 --- a/vm_exec.h +++ b/vm_exec.h @@ -40,10 +40,6 @@ typedef rb_iseq_t *ISEQ; #define throwdebug if(0)ruby_debug_printf /* #define throwdebug ruby_debug_printf */ -#ifndef USE_INSNS_COUNTER -#define USE_INSNS_COUNTER 0 -#endif - /************************************************/ #if defined(DISPATCH_XXX) error ! @@ -80,8 +76,7 @@ error ! (reg_cfp->pc - ISEQ_BODY(reg_cfp->iseq)->iseq_encoded), \ RSTRING_PTR(rb_iseq_path(reg_cfp->iseq)), \ rb_iseq_line_no(reg_cfp->iseq, reg_pc - ISEQ_BODY(reg_cfp->iseq)->iseq_encoded)); \ - } \ - if (USE_INSNS_COUNTER) vm_insns_counter_count_insn(BIN(insn)); + } #define INSN_DISPATCH_SIG(insn)