[compiler-rt] [scudo] Add a method to use a hard-coded page size (PR #106646)

via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 29 17:19:19 PDT 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 412e3e394dbd1b7d8655639e161ed4dbd5505c96 32c7db60dc5104548e2e767731f87a78afd6196b --extensions h,cpp -- compiler-rt/lib/scudo/standalone/combined.h compiler-rt/lib/scudo/standalone/common.cpp compiler-rt/lib/scudo/standalone/common.h compiler-rt/lib/scudo/standalone/platform.h compiler-rt/lib/scudo/standalone/release.h
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/compiler-rt/lib/scudo/standalone/common.h b/compiler-rt/lib/scudo/standalone/common.h
index ee9029bab3..0014054bd0 100644
--- a/compiler-rt/lib/scudo/standalone/common.h
+++ b/compiler-rt/lib/scudo/standalone/common.h
@@ -135,13 +135,9 @@ inline void computePercentage(uptr Numerator, uptr Denominator, uptr *Integral,
 
 #if defined(SCUDO_PAGE_SIZE)
 
-inline constexpr uptr getPageSizeCached() {
-  return SCUDO_PAGE_SIZE;
-}
+inline constexpr uptr getPageSizeCached() { return SCUDO_PAGE_SIZE; }
 
-inline constexpr uptr getPageSizeSlow() {
-  return getPageSizeCached();
-}
+inline constexpr uptr getPageSizeSlow() { return getPageSizeCached(); }
 
 inline constexpr uptr getPageSizeLogCached() {
   return static_cast<uptr>(__builtin_ctzl(SCUDO_PAGE_SIZE));
diff --git a/compiler-rt/lib/scudo/standalone/release.h b/compiler-rt/lib/scudo/standalone/release.h
index f8177a85ee..51abdd82aa 100644
--- a/compiler-rt/lib/scudo/standalone/release.h
+++ b/compiler-rt/lib/scudo/standalone/release.h
@@ -607,8 +607,12 @@ struct PageReleaseContext {
     return true;
   }
 
-  uptr getPageIndex(uptr P) { return (P >> getPageSizeLogCached()) - ReleasePageOffset; }
-  uptr getReleaseOffset() { return ReleasePageOffset << getPageSizeLogCached(); }
+  uptr getPageIndex(uptr P) {
+    return (P >> getPageSizeLogCached()) - ReleasePageOffset;
+  }
+  uptr getReleaseOffset() {
+    return ReleasePageOffset << getPageSizeLogCached();
+  }
 
   uptr BlockSize;
   uptr NumberOfRegions;

``````````

</details>


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


More information about the llvm-commits mailing list