From: Vlad Brezae Date: Mon, 20 Mar 2017 19:40:49 +0000 (-0400) Subject: [sgen] Emit fast inline wbarrier instead of the wrapper one X-Git-Url: http://wien.tomnetworks.com/gitweb/?p=mono.git;a=commitdiff_plain;h=7a04c99af19ed8975aa36f8c5416ca421a16f2bd [sgen] Emit fast inline wbarrier instead of the wrapper one Which seems to be about 4 times slower than the inline one. --- diff --git a/mono/mini/method-to-ir.c b/mono/mini/method-to-ir.c index 2f96bebabc3..0027bc90eb7 100644 --- a/mono/mini/method-to-ir.c +++ b/mono/mini/method-to-ir.c @@ -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);