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

ruby-changes:69106

From: Maxime <ko1@a...>
Date: Thu, 21 Oct 2021 08:20:51 +0900 (JST)
Subject: [ruby-changes:69106] dd5082d7ca (master): Use cmov to handle Qundef case in getivar instead of side-exit

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

From dd5082d7ca31adc66f885aed1af789adaf262a64 Mon Sep 17 00:00:00 2001
From: Maxime Chevalier-Boisvert <maxime.chevalierboisvert@s...>
Date: Mon, 23 Aug 2021 14:53:28 -0400
Subject: Use cmov to handle Qundef case in getivar instead of side-exit

---
 yjit_codegen.c | 8 ++++----
 yjit_iface.h   | 1 -
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/yjit_codegen.c b/yjit_codegen.c
index 127027ffa7..fc4d46a329 100644
--- a/yjit_codegen.c
+++ b/yjit_codegen.c
@@ -1453,10 +1453,9 @@ gen_get_ivar(jitstate_t *jit, ctx_t *ctx, const int max_chain_depth, VALUE compt https://github.com/ruby/ruby/blob/trunk/yjit_codegen.c#L1453
             mov(cb, REG1, ivar_opnd);
 
             // Guard that the variable is not Qundef
-            // TODO: use cmov to push Qnil in this case
-            ADD_COMMENT(cb, "guard value not Qundef");
             cmp(cb, REG1, imm_opnd(Qundef));
-            je_ptr(cb, COUNTED_EXIT(side_exit, getivar_undef));
+            mov(cb, REG0, imm_opnd(Qnil));
+            cmove(cb, REG1, REG0);
 
             // Push the ivar on the stack
             x86opnd_t out_opnd = ctx_stack_push(ctx, TYPE_UNKNOWN);
@@ -1490,7 +1489,8 @@ gen_get_ivar(jitstate_t *jit, ctx_t *ctx, const int max_chain_depth, VALUE compt https://github.com/ruby/ruby/blob/trunk/yjit_codegen.c#L1489
 
             // Check that the ivar is not Qundef
             cmp(cb, REG0, imm_opnd(Qundef));
-            je_ptr(cb, COUNTED_EXIT(side_exit, getivar_undef));
+            mov(cb, REG1, imm_opnd(Qnil));
+            cmove(cb, REG0, REG1);
 
             // Push the ivar on the stack
             x86opnd_t out_opnd = ctx_stack_push(ctx, TYPE_UNKNOWN);
diff --git a/yjit_iface.h b/yjit_iface.h
index 489803a537..4b3da00b76 100644
--- a/yjit_iface.h
+++ b/yjit_iface.h
@@ -52,7 +52,6 @@ YJIT_DECLARE_COUNTERS( https://github.com/ruby/ruby/blob/trunk/yjit_iface.h#L52
 
     getivar_se_self_not_heap,
     getivar_idx_out_of_range,
-    getivar_undef,
     getivar_name_not_mapped,
 
     setivar_se_self_not_heap,
-- 
cgit v1.2.1


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

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