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