[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:10 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));
----------------
cferris1000 wrote:

Unfortunately, I can't do that and keep the function constexpr. I want to keep it constexpr so I can add a static_assert in the Android config code to make sure the hard-coded value is being used.

I did change the common.cpp to use getLog2 function.

https://github.com/llvm/llvm-project/pull/106646


More information about the llvm-commits mailing list