summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxime Chevalier-Boisvert <maxime.chevalierboisvert@shopify.com>2021-08-23 14:53:28 -0400
committerAlan Wu <XrXr@users.noreply.github.com>2021-10-20 18:19:39 -0400
commitdd5082d7ca31adc66f885aed1af789adaf262a64 (patch)
treee06fb86d4eb28a1b86e5c644f2fa23c2d75c3a72
parentc4b99d6a427060cadde7f5561c5a3db626bc26ba (diff)
Use cmov to handle Qundef case in getivar instead of side-exit
-rw-r--r--yjit_codegen.c8
-rw-r--r--yjit_iface.h1
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
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
// 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(
getivar_se_self_not_heap,
getivar_idx_out_of_range,
- getivar_undef,
getivar_name_not_mapped,
setivar_se_self_not_heap,