summaryrefslogtreecommitdiff
path: root/vm_exec.c
diff options
context:
space:
mode:
Diffstat (limited to 'vm_exec.c')
-rw-r--r--vm_exec.c59
1 files changed, 8 insertions, 51 deletions
diff --git a/vm_exec.c b/vm_exec.c
index 36bacfd5e8..44d92e2225 100644
--- a/vm_exec.c
+++ b/vm_exec.c
@@ -11,39 +11,13 @@
#include <math.h>
-#if VM_COLLECT_USAGE_DETAILS
-static void vm_analysis_insn(int insn);
+#if USE_YJIT || USE_RJIT
+// The number of instructions executed on vm_exec_core. --yjit-stats uses this.
+uint64_t rb_vm_insns_count = 0;
#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) {}
+#if VM_COLLECT_USAGE_DETAILS
+static void vm_analysis_insn(int insn);
#endif
#if VMDEBUG > 0
@@ -68,20 +42,8 @@ static void vm_insns_counter_count_insn(int insn) {}
#if !OPT_CALL_THREADED_CODE
static VALUE
-vm_exec_core(rb_execution_context_t *ec, VALUE initial)
+vm_exec_core(rb_execution_context_t *ec)
{
-
-#if OPT_STACK_CACHING
-#if 0
-#elif __GNUC__ && __x86_64__
- DECL_SC_REG(VALUE, a, "12");
- DECL_SC_REG(VALUE, b, "13");
-#else
- register VALUE reg_a;
- register VALUE reg_b;
-#endif
-#endif
-
#if defined(__GNUC__) && defined(__i386__)
DECL_SC_REG(const VALUE *, pc, "di");
DECL_SC_REG(rb_control_frame_t *, cfp, "si");
@@ -135,11 +97,6 @@ vm_exec_core(rb_execution_context_t *ec, VALUE initial)
reg_cfp = ec->cfp;
reg_pc = reg_cfp->pc;
-#if OPT_STACK_CACHING
- reg_a = initial;
- reg_b = 0;
-#endif
-
first:
INSN_DISPATCH();
/*****************/
@@ -155,7 +112,7 @@ vm_exec_core(rb_execution_context_t *ec, VALUE initial)
const void **
rb_vm_get_insns_address_table(void)
{
- return (const void **)vm_exec_core(0, 0);
+ return (const void **)vm_exec_core(0);
}
#else /* OPT_CALL_THREADED_CODE */
@@ -170,7 +127,7 @@ rb_vm_get_insns_address_table(void)
}
static VALUE
-vm_exec_core(rb_execution_context_t *ec, VALUE initial)
+vm_exec_core(rb_execution_context_t *ec)
{
register rb_control_frame_t *reg_cfp = ec->cfp;
rb_thread_t *th;