[compiler-rt] b4e0890 - [NFC] [scudo] move static_assert closer to class it relates to (#84257)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 11 11:48:46 PDT 2024
Author: Florian Mayer
Date: 2024-03-11T11:46:45-07:00
New Revision: b4e0890458043ef486fdecba9aad65799ec0ab35
URL: https://github.com/llvm/llvm-project/commit/b4e0890458043ef486fdecba9aad65799ec0ab35
DIFF: https://github.com/llvm/llvm-project/commit/b4e0890458043ef486fdecba9aad65799ec0ab35.diff
LOG: [NFC] [scudo] move static_assert closer to class it relates to (#84257)
delete other static_assert
Added:
Modified:
compiler-rt/lib/scudo/standalone/combined.h
compiler-rt/lib/scudo/standalone/stack_depot.h
Removed:
################################################################################
diff --git a/compiler-rt/lib/scudo/standalone/combined.h b/compiler-rt/lib/scudo/standalone/combined.h
index 069b5f64475db5..4dacfac707926d 100644
--- a/compiler-rt/lib/scudo/standalone/combined.h
+++ b/compiler-rt/lib/scudo/standalone/combined.h
@@ -1553,16 +1553,6 @@ class Allocator {
constexpr u32 kFramesPerStack = 16;
static_assert(isPowerOfTwo(kFramesPerStack));
- // We need StackDepot to be aligned to 8-bytes so the ring we store after
- // is correctly assigned.
- static_assert(sizeof(StackDepot) % alignof(atomic_u64) == 0);
-
- // Make sure the maximum sized StackDepot fits withint a uintptr_t to
- // simplify the overflow checking.
- static_assert(sizeof(StackDepot) + UINT32_MAX * sizeof(atomic_u64) *
- UINT32_MAX * sizeof(atomic_u32) <
- UINTPTR_MAX);
-
if (AllocationRingBufferSize > kMaxU32Pow2 / kStacksPerRingBufferEntry)
return;
u32 TabSize = static_cast<u32>(roundUpPowerOfTwo(kStacksPerRingBufferEntry *
diff --git a/compiler-rt/lib/scudo/standalone/stack_depot.h b/compiler-rt/lib/scudo/standalone/stack_depot.h
index 620137e44f3723..cf3cabf7085b60 100644
--- a/compiler-rt/lib/scudo/standalone/stack_depot.h
+++ b/compiler-rt/lib/scudo/standalone/stack_depot.h
@@ -199,6 +199,10 @@ class alignas(atomic_u64) StackDepot {
void enable() NO_THREAD_SAFETY_ANALYSIS { RingEndMu.unlock(); }
};
+// We need StackDepot to be aligned to 8-bytes so the ring we store after
+// is correctly assigned.
+static_assert(sizeof(StackDepot) % alignof(atomic_u64) == 0);
+
} // namespace scudo
#endif // SCUDO_STACK_DEPOT_H_
More information about the llvm-commits
mailing list