[compiler-rt] [scudo] Add a method to use a hard-coded page size (PR #106646)
Christopher Ferris via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 4 16:50:09 PDT 2024
================
@@ -133,18 +133,39 @@ inline void computePercentage(uptr Numerator, uptr Denominator, uptr *Integral,
// Platform specific functions.
+#if defined(SCUDO_PAGE_SIZE)
+
+inline constexpr uptr getPageSizeCached() { return SCUDO_PAGE_SIZE; }
+
+inline constexpr uptr getPageSizeSlow() { return getPageSizeCached(); }
+
+inline constexpr uptr getPageSizeLogCached() {
+ return static_cast<uptr>(__builtin_ctzl(SCUDO_PAGE_SIZE));
+}
+
+#else
+
extern uptr PageSizeCached;
+extern uptr PageSizeLogCached;
+
uptr getPageSizeSlow();
+
inline uptr getPageSizeCached() {
-#if SCUDO_ANDROID && defined(PAGE_SIZE)
- // Most Android builds have a build-time constant page size.
- return PAGE_SIZE;
-#endif
if (LIKELY(PageSizeCached))
return PageSizeCached;
return getPageSizeSlow();
}
+inline uptr getPageSizeLogCached() {
+ if (LIKELY(PageSizeLogCached)) {
----------------
cferris1000 wrote:
Fixed.
https://github.com/llvm/llvm-project/pull/106646
More information about the llvm-commits
mailing list