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