@@ -1163,7 +1163,7 @@ gen_fixnum_cmp(jitstate_t* jit, ctx_t* ctx, cmov_fn cmov_op)
1163
1163
// Check that both operands are fixnums
1164
1164
guard_two_fixnums (ctx , side_exit );
1165
1165
1166
- // Get the operands and destination from the stack
1166
+ // Get the operands from the stack
1167
1167
x86opnd_t arg1 = ctx_stack_pop (ctx , 1 );
1168
1168
x86opnd_t arg0 = ctx_stack_pop (ctx , 1 );
1169
1169
@@ -1205,6 +1205,36 @@ gen_opt_gt(jitstate_t* jit, ctx_t* ctx)
1205
1205
return gen_fixnum_cmp (jit , ctx , cmovg );
1206
1206
}
1207
1207
1208
+ VALUE rb_opt_equality_specialized (VALUE recv , VALUE obj );
1209
+
1210
+ static codegen_status_t
1211
+ gen_opt_eq (jitstate_t * jit , ctx_t * ctx )
1212
+ {
1213
+ uint8_t * side_exit = yjit_side_exit (jit , ctx );
1214
+
1215
+ // Get the operands from the stack
1216
+ x86opnd_t arg1 = ctx_stack_pop (ctx , 1 );
1217
+ x86opnd_t arg0 = ctx_stack_pop (ctx , 1 );
1218
+
1219
+ // Call rb_opt_equality_specialized(VALUE recv, VALUE obj)
1220
+ // We know this method won't allocate or perform calls
1221
+ yjit_save_regs (cb );
1222
+ mov (cb , C_ARG_REGS [0 ], arg0 );
1223
+ mov (cb , C_ARG_REGS [1 ], arg1 );
1224
+ call_ptr (cb , REG0 , (void * )rb_opt_equality_specialized );
1225
+ yjit_load_regs (cb );
1226
+
1227
+ // If val == Qundef, bail to do a method call
1228
+ cmp (cb , RAX , imm_opnd (Qundef ));
1229
+ je_ptr (cb , side_exit );
1230
+
1231
+ // Push the return value onto the stack
1232
+ x86opnd_t stack_ret = ctx_stack_push (ctx , TYPE_IMM );
1233
+ mov (cb , stack_ret , RAX );
1234
+
1235
+ return YJIT_KEEP_COMPILING ;
1236
+ }
1237
+
1208
1238
static codegen_status_t gen_opt_send_without_block (jitstate_t * jit , ctx_t * ctx );
1209
1239
1210
1240
static codegen_status_t
@@ -2453,6 +2483,7 @@ yjit_init_codegen(void)
2453
2483
yjit_reg_op (BIN (opt_le ), gen_opt_le );
2454
2484
yjit_reg_op (BIN (opt_ge ), gen_opt_ge );
2455
2485
yjit_reg_op (BIN (opt_gt ), gen_opt_gt );
2486
+ yjit_reg_op (BIN (opt_eq ), gen_opt_eq );
2456
2487
yjit_reg_op (BIN (opt_aref ), gen_opt_aref );
2457
2488
yjit_reg_op (BIN (opt_and ), gen_opt_and );
2458
2489
yjit_reg_op (BIN (opt_or ), gen_opt_or );
0 commit comments