@@ -625,21 +625,15 @@ gen_setlocal_wc0(jitstate_t* jit, ctx_t* ctx)
625
625
static void
626
626
guard_self_is_heap (codeblock_t * cb , x86opnd_t self_opnd , uint8_t * side_exit , ctx_t * ctx )
627
627
{
628
+
628
629
// `self` is constant throughout the entire region, so we only need to do this check once.
629
630
if (!ctx -> self_type .is_heap ) {
630
- // FIXME: use two-comparison test
631
631
ADD_COMMENT (cb , "guard self is heap" );
632
+ RUBY_ASSERT (Qfalse < Qnil );
632
633
test (cb , self_opnd , imm_opnd (RUBY_IMMEDIATE_MASK ));
633
634
jnz_ptr (cb , side_exit );
634
- cmp (cb , self_opnd , imm_opnd (Qfalse ));
635
- je_ptr (cb , side_exit );
636
635
cmp (cb , self_opnd , imm_opnd (Qnil ));
637
- je_ptr (cb , side_exit );
638
-
639
- // maybe we can do
640
- // RUBY_ASSERT(Qfalse < Qnil);
641
- // cmp(cb, self_opnd, imm_opnd(Qnil));
642
- // jbe(cb, side_exit);
636
+ jbe_ptr (cb , side_exit );
643
637
644
638
ctx -> self_type .is_heap = 1 ;
645
639
}
@@ -1432,12 +1426,11 @@ jit_guard_known_klass(jitstate_t *jit, ctx_t* ctx, VALUE known_klass, insn_opnd_
1432
1426
{
1433
1427
// FIXME: use two comparisons instead of 3 here
1434
1428
ADD_COMMENT (cb , "guard not immediate" );
1429
+ RUBY_ASSERT (Qfalse < Qnil );
1435
1430
test (cb , REG0 , imm_opnd (RUBY_IMMEDIATE_MASK ));
1436
1431
jnz_ptr (cb , side_exit );
1437
- cmp (cb , REG0 , imm_opnd (Qfalse ));
1438
- je_ptr (cb , side_exit );
1439
1432
cmp (cb , REG0 , imm_opnd (Qnil ));
1440
- je_ptr (cb , side_exit );
1433
+ jbe_ptr (cb , side_exit );
1441
1434
1442
1435
ctx_set_opnd_type (ctx , insn_opnd , TYPE_HEAP );
1443
1436
}
0 commit comments