When doing memory copy dest is the destination address and src is the source address. If we are copying a single reference, we need to emit a write barrier and pass to the write barrier the value, not the pointer where the value is stored.
Commit migrated from https://github.com/mono/mono/commit/
8e649c35450e77e68ff468ced77987e4c0b51f99
NEW_STORE_MEMBASE (cfg, store, OP_STORE_MEMBASE_REG, dest->dreg, 0, dreg);
MONO_ADD_INS (cfg->cbb, store);
- mini_emit_write_barrier (cfg, dest, src);
+ mini_emit_write_barrier (cfg, dest, load);
return;
} else if (cfg->gen_write_barriers && (m_class_has_references (klass) || size_ins) && !native) { /* if native is true there should be no references in the struct */