diff options
-rw-r--r-- | proc.c | 8 | ||||
-rw-r--r-- | yjit.h | 2 | ||||
-rw-r--r-- | yjit.rb | 3 | ||||
-rw-r--r-- | yjit_iface.c | 12 | ||||
-rw-r--r-- | yjit_iface.h | 3 |
5 files changed, 28 insertions, 0 deletions
@@ -21,6 +21,7 @@ #include "method.h" #include "iseq.h" #include "vm_core.h" +#include "yjit.h" #if !defined(__GNUC__) || __GNUC__ < 5 || defined(__MINGW32__) # define NO_CLOBBERED(v) (*(volatile VALUE *)&(v)) @@ -346,6 +347,9 @@ rb_binding_alloc(VALUE klass) VALUE obj; rb_binding_t *bind; obj = TypedData_Make_Struct(klass, rb_binding_t, &ruby_binding_data_type, bind); +#if RUBY_DEBUG + rb_yjit_collect_binding_alloc(); +#endif return obj; } @@ -610,6 +614,10 @@ bind_local_variable_set(VALUE bindval, VALUE sym, VALUE val) env = VM_ENV_ENVVAL_PTR(vm_block_ep(&bind->block)); } +#if RUBY_DEBUG + rb_yjit_collect_binding_set(); +#endif + RB_OBJ_WRITE(env, ptr, val); return val; @@ -51,6 +51,8 @@ void rb_yjit_invalidate_all_method_lookup_assumptions(void); void rb_yjit_method_lookup_change(VALUE klass, ID mid); void rb_yjit_cme_invalidate(VALUE cme); void rb_yjit_collect_vm_usage_insn(int insn); +void rb_yjit_collect_binding_alloc(void); +void rb_yjit_collect_binding_set(void); void rb_yjit_compile_iseq(const rb_iseq_t *iseq, rb_execution_context_t *ec); void rb_yjit_init(struct rb_yjit_options *options); void rb_yjit_bop_redefined(VALUE klass, const rb_method_entry_t *me, enum ruby_basic_operators bop); @@ -60,6 +60,9 @@ module YJIT $stderr.puts("***YJIT: Printing runtime counters from yjit.rb***") + $stderr.puts "Number of Bindings Allocated: %d\n" % counters[:binding_allocation_count] + $stderr.puts "Number of locals modified through binding: %d\n" % counters[:local_variable_set_count] + print_counters(counters, prefix: 'oswb_', prompt: 'opt_send_without_block exit reasons: ') print_counters(counters, prefix: 'leave_', prompt: 'leave exit reasons: ') print_counters(counters, prefix: 'getivar_', prompt: 'getinstancevariable exit reasons:') diff --git a/yjit_iface.c b/yjit_iface.c index 4e931f4c8d..989f7f9a56 100644 --- a/yjit_iface.c +++ b/yjit_iface.c @@ -726,6 +726,18 @@ rb_yjit_collect_vm_usage_insn(int insn) vm_insns_count++; } +void +rb_yjit_collect_binding_alloc(void) +{ + yjit_runtime_counters.binding_allocations++; +} + +void +rb_yjit_collect_binding_set(void) +{ + yjit_runtime_counters.binding_set++; +} + const VALUE * rb_yjit_count_side_exit_op(const VALUE *exit_pc) { diff --git a/yjit_iface.h b/yjit_iface.h index bc1f1a7ad6..6428906b28 100644 --- a/yjit_iface.h +++ b/yjit_iface.h @@ -58,6 +58,9 @@ YJIT_DECLARE_COUNTERS( oaref_argc_not_one, oaref_arg_not_fixnum, + binding_allocations, + binding_set, + // Member with known name for iterating over counters last_member ) |