tsan: allow fast large MemoryRangeSet on non-Windows Go

The fast reset for large memory regions is not working
only on windows. So enable it for Go/linux/darwin/freebsd.

See https://github.com/golang/go/issues/20139
for background and motivation.

Based on idea by Josh Bleecher Snyder.

llvm-svn: 301927
This commit is contained in:
Dmitry Vyukov 2017-05-02 15:15:45 +00:00
parent 7fc481e561
commit 2b66b5a3b7
1 changed files with 2 additions and 3 deletions

View File

@ -866,9 +866,8 @@ static void MemoryRangeSet(ThreadState *thr, uptr pc, uptr addr, uptr size,
// Don't want to touch lots of shadow memory.
// If a program maps 10MB stack, there is no need reset the whole range.
size = (size + (kShadowCell - 1)) & ~(kShadowCell - 1);
// UnmapOrDie/MmapFixedNoReserve does not work on Windows,
// so we do it only for C/C++.
if (SANITIZER_GO || size < common_flags()->clear_shadow_mmap_threshold) {
// UnmapOrDie/MmapFixedNoReserve does not work on Windows.
if (SANITIZER_WINDOWS || size < common_flags()->clear_shadow_mmap_threshold) {
u64 *p = (u64*)MemToShadow(addr);
CHECK(IsShadowMem((uptr)p));
CHECK(IsShadowMem((uptr)(p + size * kShadowCnt / kShadowCell - 1)));