Skip to content

Commit 397e91f

Browse files
authored
[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).
1 parent fa70b5d commit 397e91f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

compiler-rt/lib/memprof/memprof_mapping.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ extern uptr kHighMemEnd; // Initialized in __memprof_init.
2929

3030
} // namespace __memprof
3131

32-
#define SHADOW_ENTRY_SIZE 8
33-
3432
// Size of memory block mapped to a single shadow location
3533
#define MEM_GRANULARITY 64ULL
3634

@@ -39,6 +37,8 @@ extern uptr kHighMemEnd; // Initialized in __memprof_init.
3937
#define MEM_TO_SHADOW(mem) \
4038
((((mem) & SHADOW_MASK) >> SHADOW_SCALE) + (SHADOW_OFFSET))
4139

40+
#define SHADOW_ENTRY_SIZE (MEM_GRANULARITY >> SHADOW_SCALE)
41+
4242
#define kLowMemBeg 0
4343
#define kLowMemEnd (SHADOW_OFFSET ? SHADOW_OFFSET - 1 : 0)
4444

0 commit comments

Comments
 (0)