forked from OSchip/llvm-project
tsan: make IsMetaMem accept u32*
MemToMeta returns u32*, so it's reasonable for IsMetaMem to accept u32* as well. Changing the argument type just removes few type casts. Reviewed By: vitalybuka Differential Revision: https://reviews.llvm.org/D107481
This commit is contained in:
parent
530ea28fef
commit
c7a4ede351
|
@ -195,7 +195,7 @@ const char *__tsan_locate_address(uptr addr, char *name, uptr name_size,
|
|||
const char *region_kind = nullptr;
|
||||
if (name && name_size > 0) name[0] = 0;
|
||||
|
||||
if (IsMetaMem(addr)) {
|
||||
if (IsMetaMem(reinterpret_cast<u32 *>(addr))) {
|
||||
region_kind = "meta shadow";
|
||||
} else if (IsShadowMem(addr)) {
|
||||
region_kind = "shadow";
|
||||
|
|
|
@ -892,7 +892,8 @@ bool IsMetaMemImpl(uptr mem) {
|
|||
}
|
||||
|
||||
ALWAYS_INLINE
|
||||
bool IsMetaMem(uptr mem) {
|
||||
bool IsMetaMem(const u32 *p) {
|
||||
uptr mem = reinterpret_cast<uptr>(p);
|
||||
#if defined(__aarch64__) && !defined(__APPLE__) && !SANITIZER_GO
|
||||
switch (vmaSize) {
|
||||
case 39: return IsMetaMemImpl<Mapping39>(mem);
|
||||
|
@ -926,7 +927,6 @@ bool IsMetaMem(uptr mem) {
|
|||
#endif
|
||||
}
|
||||
|
||||
|
||||
template<typename Mapping>
|
||||
uptr MemToShadowImpl(uptr x) {
|
||||
DCHECK(IsAppMem(x));
|
||||
|
|
|
@ -328,7 +328,7 @@ static void CheckShadowMapping() {
|
|||
if (p < beg || p >= end)
|
||||
continue;
|
||||
const uptr s = MemToShadow(p);
|
||||
const uptr m = (uptr)MemToMeta(p);
|
||||
u32 *const m = MemToMeta(p);
|
||||
VPrintf(3, " checking pointer %p: shadow=%p meta=%p\n", p, s, m);
|
||||
CHECK(IsAppMem(p));
|
||||
CHECK(IsShadowMem(s));
|
||||
|
@ -338,10 +338,9 @@ static void CheckShadowMapping() {
|
|||
// Ensure that shadow and meta mappings are linear within a single
|
||||
// user range. Lots of code that processes memory ranges assumes it.
|
||||
const uptr prev_s = MemToShadow(prev);
|
||||
const uptr prev_m = (uptr)MemToMeta(prev);
|
||||
u32 *const prev_m = MemToMeta(prev);
|
||||
CHECK_EQ(s - prev_s, (p - prev) * kShadowMultiplier);
|
||||
CHECK_EQ((m - prev_m) / kMetaShadowSize,
|
||||
(p - prev) / kMetaShadowCell);
|
||||
CHECK_EQ(m - prev_m, (p - prev) / kMetaShadowCell);
|
||||
}
|
||||
prev = p;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue