[compiler-rt] 397e91f - [MemProf][NFC] Compute SHADOW_ENTRY_SIZE from MEM_GRANULARITY and SHA… (#80589)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 5 22:25:59 PST 2024
Author: Enna1
Date: 2024-02-06T14:25:55+08:00
New Revision: 397e91f0f387bf2db0cc320a9078a60d2334545e
URL: https://github.com/llvm/llvm-project/commit/397e91f0f387bf2db0cc320a9078a60d2334545e
DIFF: https://github.com/llvm/llvm-project/commit/397e91f0f387bf2db0cc320a9078a60d2334545e.diff
LOG: [MemProf][NFC] Compute SHADOW_ENTRY_SIZE from MEM_GRANULARITY and SHA… (#80589)
…DOW_SCALE
As MEM_GRANULARITY represents the size of memory block mapped to a
single shadow entry, and SHADOW_SCALE represents the scale of shadow
mapping, so the single shadow entry size can be computed as
(MEM_GRANULARITY >> SHADOW_SCALE).
This patch replaces the hardcoded SHADOW_ENTRY_SIZE with
(MEM_GRANULARITY >> SHADOW_SCALE).
Added:
Modified:
compiler-rt/lib/memprof/memprof_mapping.h
Removed:
################################################################################
diff --git a/compiler-rt/lib/memprof/memprof_mapping.h b/compiler-rt/lib/memprof/memprof_mapping.h
index ba05b88db3070..1cc0836834cdf 100644
--- a/compiler-rt/lib/memprof/memprof_mapping.h
+++ b/compiler-rt/lib/memprof/memprof_mapping.h
@@ -29,8 +29,6 @@ extern uptr kHighMemEnd; // Initialized in __memprof_init.
} // namespace __memprof
-#define SHADOW_ENTRY_SIZE 8
-
// Size of memory block mapped to a single shadow location
#define MEM_GRANULARITY 64ULL
@@ -39,6 +37,8 @@ extern uptr kHighMemEnd; // Initialized in __memprof_init.
#define MEM_TO_SHADOW(mem) \
((((mem) & SHADOW_MASK) >> SHADOW_SCALE) + (SHADOW_OFFSET))
+#define SHADOW_ENTRY_SIZE (MEM_GRANULARITY >> SHADOW_SCALE)
+
#define kLowMemBeg 0
#define kLowMemEnd (SHADOW_OFFSET ? SHADOW_OFFSET - 1 : 0)
More information about the llvm-commits
mailing list