[PATCH] D14199: [compiler-rt] [tsan] Unify aarch64 mapping
Adhemerval Zanella via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 5 08:28:20 PST 2015
zatrazz added inline comments.
================
Comment at: lib/tsan/rtl/tsan_platform.h:186
@@ -152,3 +185,3 @@
return (mem >= kHeapMemBeg && mem < kHeapMemEnd) ||
(mem >= kLoAppMemBeg && mem < kLoAppMemEnd) ||
(mem >= kHiAppMemBeg && mem < kHiAppMemEnd);
----------------
dvyukov wrote:
> Won't it then be faster to inline all 3 variants?
>
> E.g.
>
> struct Mapping39 {
> static const uptr kLoAppMemBeg = 0x...;
> static const uptr kLoAppMemEnd = 0x...;
> static const uptr kShadowBeg = 0x...;
> ...
> };
>
> struct Mapping42 {
> static const uptr kLoAppMemBeg = 0x...;
> static const uptr kLoAppMemEnd = 0x...;
> static const uptr kShadowBeg = 0x...;
> ...
> };
>
> template<typename Mapping>
> uptr MemToShadowImpl(uptr x) {
> return (((x) & ~(Mapping::kAppMemMsk | (kShadowCell - 1)))
> ^ Mapping::kAppMemXor) * kShadowCnt;
> }
>
> uptr MemToShadow(uptr x) {
> if (vma_size == 39)
> return MemToShadowImpl<Mapping39>(x);
> else
> return MemToShadowImpl<Mapping42>(x);
> DCHECK(0);
> }
>
> I suspect it can be faster as it is inlinable. And probably compiler will be able to do some common expressions merging, so the code won't be too large.
I will check this out, thanks!
http://reviews.llvm.org/D14199
More information about the llvm-commits
mailing list