Optimize mono_gc_bzero and mono_gc_memmove to closely match native performance.
commit8a6a647e00b2db4235cc0d3c49e36944a52caf52
authorRodrigo Kumpera <kumpera@gmail.com>
Mon, 11 Mar 2013 15:03:13 +0000 (11 11:03 -0400)
committerRodrigo Kumpera <kumpera@gmail.com>
Mon, 11 Mar 2013 22:45:55 +0000 (11 18:45 -0400)
tree974f4dc79baa23d4cece1975d4ba587bc794e63f
parentdde2c3988006990a29af2b5b3a9dff2c2e37b2f0
Optimize mono_gc_bzero and mono_gc_memmove to closely match native performance.

* gc.c (mono_gc_memmove): Doing naive word copy turned out to be several times
slower than optimized memmove.Doing optimized memmove is a hellbent problem
because each target (x86, amd64, arm, etc) have multiple implementations based
on which CPU you're currently running on.

Given we're not ready to suck in ten thousand lines of assembly for the benefit
of a few targets a better solution is needed.

The problem we face is due to implementations that don't perform word stores
on the word aligned parts of the destination. This does break things for us
as the CLI environment disallows word tearing for normal operations.

The solution is then to work around the silliness of the known implementations
that basically handle any sorts of misalignment badly. To do so we ensure that
we only call memmove with a word aligned destination and a word multiple size.

This should be enough for OSX, Android, linux and iOS on x86, amd64 and ARM.
mono/metadata/gc-internal.h
mono/metadata/gc.c