Skip to content

Commit 79b569f

Browse files
authored
Merge pull request #206 from Shopify/stats-interpt-insns
Count interpreter instructions when -DYJIT_STATS=1
2 parents 75213b4 + ecb5b38 commit 79b569f

File tree

3 files changed

+9
-15
lines changed

3 files changed

+9
-15
lines changed

vm.c

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "internal/sanitizers.h"
2929
#include "iseq.h"
3030
#include "mjit.h"
31+
#include "yjit.h"
3132
#include "ruby/st.h"
3233
#include "ruby/vm.h"
3334
#include "vm_core.h"
@@ -37,7 +38,6 @@
3738
#include "vm_insnhelper.h"
3839
#include "ractor_core.h"
3940
#include "vm_sync.h"
40-
#include "yjit.h"
4141

4242
#include "builtin.h"
4343

@@ -345,10 +345,6 @@ static void vm_collect_usage_insn(int insn);
345345
static void vm_collect_usage_register(int reg, int isset);
346346
#endif
347347

348-
#if RUBY_DEBUG
349-
static void vm_yjit_collect_usage_insn(int insn);
350-
#endif
351-
352348
static VALUE vm_make_env_object(const rb_execution_context_t *ec, rb_control_frame_t *cfp);
353349
extern VALUE rb_vm_invoke_bmethod(rb_execution_context_t *ec, rb_proc_t *proc, VALUE self,
354350
int argc, const VALUE *argv, int kw_splat, VALUE block_handler,
@@ -4061,14 +4057,6 @@ MAYBE_UNUSED(static void (*ruby_vm_collect_usage_func_register)(int reg, int iss
40614057

40624058
#endif
40634059

4064-
#if RUBY_DEBUG
4065-
static void
4066-
vm_yjit_collect_usage_insn(int insn)
4067-
{
4068-
rb_yjit_collect_vm_usage_insn(insn);
4069-
}
4070-
#endif
4071-
40724060
#if VM_COLLECT_USAGE_DETAILS
40734061
/* @param insn instruction number */
40744062
static void

vm_insnhelper.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ MJIT_SYMBOL_EXPORT_END
2525
#define COLLECT_USAGE_OPERAND(insn, n, op) vm_collect_usage_operand((insn), (n), ((VALUE)(op)))
2626

2727
#define COLLECT_USAGE_REGISTER(reg, s) vm_collect_usage_register((reg), (s))
28-
#elif RUBY_DEBUG
28+
#elif YJIT_STATS
2929
/* for --yjit-stats */
30-
#define COLLECT_USAGE_INSN(insn) vm_yjit_collect_usage_insn(insn)
30+
#define COLLECT_USAGE_INSN(insn) rb_yjit_collect_vm_usage_insn(insn)
3131
#define COLLECT_USAGE_OPERAND(insn, n, op) /* none */
3232
#define COLLECT_USAGE_REGISTER(reg, s) /* none */
3333
#else

yjit.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
#ifndef YJIT_H
66
#define YJIT_H 1
77

8+
#include "ruby/internal/config.h"
9+
#include "ruby_assert.h" // for RUBY_DEBUG
810
#include "vm_core.h"
911
#include "method.h"
1012

@@ -26,6 +28,10 @@
2628
#define YJIT_DUMP_MODE 0
2729
#endif
2830

31+
#ifndef YJIT_STATS
32+
# define YJIT_STATS RUBY_DEBUG
33+
#endif // ifndef YJIT_STATS
34+
2935
#ifndef rb_iseq_t
3036
typedef struct rb_iseq_struct rb_iseq_t;
3137
#define rb_iseq_t rb_iseq_t

0 commit comments

Comments
 (0)