[JIT/GC] Optimize mono_gc_wbarrier_value_copy_bitmap.
authorRodrigo Kumpera <kumpera@gmail.com>
Mon, 17 Apr 2017 22:51:33 +0000 (15:51 -0700)
committerRodrigo Kumpera <kumpera@gmail.com>
Mon, 17 Apr 2017 22:51:33 +0000 (15:51 -0700)
commit53914b88bb7d6fabb53d88dda6a92ca9045d5da8
tree5bbcce4fd20be3fda0b1a481976f10bf9e99e639
parent3ee037c8309d0e662df00dafc60ac9ca81231479
[JIT/GC] Optimize mono_gc_wbarrier_value_copy_bitmap.

mono_gc_wbarrier_value_copy_bitmap shown up when profiling Roslyn and this PR applies the following set of optimizations to it:

- Drop the bitmap, the extra branch in the loop costs more than the extra cardtable store itself
- Rename it to mono_gc_wbarrier_range_copy to reflect its new meaning
- Remove the JIT wrapper, this function doesn't need it
- Use mono_gc_get_range_copy_func as a way to punch through all layers and get the actual implementation
- Move the implementation to sgen-cardtable.c where everything can be inlined
- Exploit the fact we only need to mark the first card of a given range and thus we can hoist the address calculation outside of the loop

All of this speeds up a microbenchmark by 2x and Roslyn wallclock by around 2%.
mono/metadata/boehm-gc.c
mono/metadata/gc-internals.h
mono/metadata/null-gc.c
mono/metadata/sgen-mono.c
mono/mini/method-to-ir.c
mono/mini/mini-runtime.c
mono/sgen/sgen-cardtable.c
mono/sgen/sgen-gc.c
mono/sgen/sgen-gc.h