[sgen] Emit fast inline wbarrier instead of the wrapper one
authorVlad Brezae <brezaevlad@gmail.com>
Mon, 20 Mar 2017 19:40:49 +0000 (15:40 -0400)
committerAndi McClure <andi.mcclure@xamarin.com>
Thu, 30 Mar 2017 21:37:52 +0000 (17:37 -0400)
Which seems to be about 4 times slower than the inline one.

mono/mini/method-to-ir.c

index 2f96bebabc34afb0c6557ceb46ff9595dafdace0..0027bc90eb75dd699c42cafcf87070025801981a 100644 (file)
@@ -3008,11 +3008,18 @@ emit_write_barrier (MonoCompile *cfg, MonoInst *ptr, MonoInst *value)
                wbarrier->sreg1 = ptr->dreg;
                wbarrier->sreg2 = value->dreg;
                MONO_ADD_INS (cfg->cbb, wbarrier);
-       } else if (card_table && !cfg->compile_aot && !mono_gc_card_table_nursery_check ()) {
+       } else if (card_table) {
                int offset_reg = alloc_preg (cfg);
                int card_reg;
                MonoInst *ins;
 
+               /*
+                * We emit a fast light weight write barrier. This always marks cards as in the concurrent
+                * collector case, so, for the serial collector, it might slightly slow down nursery
+                * collections. We also expect that the host system and the target system have the same card
+                * table configuration, which is the case if they have the same pointer size.
+                */
+
                MONO_EMIT_NEW_BIALU_IMM (cfg, OP_SHR_UN_IMM, offset_reg, ptr->dreg, card_table_shift_bits);
                if (card_table_mask)
                        MONO_EMIT_NEW_BIALU_IMM (cfg, OP_PAND_IMM, offset_reg, offset_reg, card_table_mask);