[前][次][番号順一覧][スレッド一覧]

ruby-changes:68862

From: Alan <ko1@a...>
Date: Thu, 21 Oct 2021 08:14:58 +0900 (JST)
Subject: [ruby-changes:68862] db53decad6 (master): Exit reason breakdown for opt_aref

https://git.ruby-lang.org/ruby.git/commit/?id=db53decad6

From db53decad6db5eedf9d9090e14f7d2216549f9d0 Mon Sep 17 00:00:00 2001
From: Alan Wu <XrXr@u...>
Date: Thu, 11 Mar 2021 11:25:19 -0500
Subject: Exit reason breakdown for opt_aref

---
 yjit.rb        | 1 +
 yjit_codegen.c | 6 ++++--
 yjit_iface.h   | 5 +++++
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/yjit.rb b/yjit.rb
index 323d6bfea9..5daee855e1 100644
--- a/yjit.rb
+++ b/yjit.rb
@@ -63,6 +63,7 @@ module YJIT https://github.com/ruby/ruby/blob/trunk/yjit.rb#L63
       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:')
+      print_counters(counters, prefix: 'oaref_', prompt: 'opt_aref exit reasons: ')
     end
 
     def print_counters(counters, prefix:, prompt:)
diff --git a/yjit_codegen.c b/yjit_codegen.c
index 823f30f87f..7d591a9147 100644
--- a/yjit_codegen.c
+++ b/yjit_codegen.c
@@ -924,6 +924,7 @@ gen_opt_aref(jitstate_t* jit, ctx_t* ctx) https://github.com/ruby/ruby/blob/trunk/yjit_codegen.c#L924
 
     // Only JIT one arg calls like `ary[6]`
     if (argc != 1) {
+        GEN_COUNTER_INC(cb, oaref_argc_not_one);
         return YJIT_CANT_COMPILE;
     }
 
@@ -933,6 +934,7 @@ gen_opt_aref(jitstate_t* jit, ctx_t* ctx) https://github.com/ruby/ruby/blob/trunk/yjit_codegen.c#L934
     // (including arrays) don't use the inline cache, so if the inline cache
     // has an entry, then this must be used by some other type.
     if (cme) {
+        GEN_COUNTER_INC(cb, oaref_filled_cc);
         return YJIT_CANT_COMPILE;
     }
 
@@ -962,12 +964,12 @@ gen_opt_aref(jitstate_t* jit, ctx_t* ctx) https://github.com/ruby/ruby/blob/trunk/yjit_codegen.c#L964
     mov(cb, REG1, mem_opnd(64, REG0, offsetof(struct RBasic, klass)));
     mov(cb, REG0, const_ptr_opnd((void *)rb_cArray));
     cmp(cb, REG0, REG1);
-    jne_ptr(cb, side_exit);
+    jne_ptr(cb, COUNTED_EXIT(side_exit, oaref_not_array));
 
     // Bail if idx is not a FIXNUM
     mov(cb, REG1, idx_opnd);
     test(cb, REG1, imm_opnd(RUBY_FIXNUM_FLAG));
-    jz_ptr(cb, side_exit);
+    jz_ptr(cb, COUNTED_EXIT(side_exit, oaref_arg_not_fixnum));
 
     // Save YJIT registers
     yjit_save_regs(cb);
diff --git a/yjit_iface.h b/yjit_iface.h
index 5a5ba1c448..a0fc4b72ed 100644
--- a/yjit_iface.h
+++ b/yjit_iface.h
@@ -51,6 +51,11 @@ YJIT_DECLARE_COUNTERS( https://github.com/ruby/ruby/blob/trunk/yjit_iface.h#L51
     getivar_idx_out_of_range,
     getivar_undef,
 
+    oaref_filled_cc,
+    oaref_argc_not_one,
+    oaref_not_array,
+    oaref_arg_not_fixnum,
+
     // Member with known name for iterating over counters
     last_member
 )
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]