[compiler-rt] 1ff8657 - [scudo] Use variable instead of recomputing. (#106647)

via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 4 14:12:29 PDT 2024


Author: Christopher Ferris
Date: 2024-09-04T14:12:25-07:00
New Revision: 1ff8657b26870e9db4527b621fab0d21b6cbdc3c

URL: https://github.com/llvm/llvm-project/commit/1ff8657b26870e9db4527b621fab0d21b6cbdc3c
DIFF: https://github.com/llvm/llvm-project/commit/1ff8657b26870e9db4527b621fab0d21b6cbdc3c.diff

LOG: [scudo] Use variable instead of recomputing. (#106647)

In the get fragmentation functions, there is already a variable that
computes the
in use bytes, so use that instead of recomputing it.

Added: 
    

Modified: 
    compiler-rt/lib/scudo/standalone/primary32.h
    compiler-rt/lib/scudo/standalone/primary64.h

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/scudo/standalone/primary32.h b/compiler-rt/lib/scudo/standalone/primary32.h
index ebfb8dfe0a31f4..87264471be2c1a 100644
--- a/compiler-rt/lib/scudo/standalone/primary32.h
+++ b/compiler-rt/lib/scudo/standalone/primary32.h
@@ -940,7 +940,7 @@ template <typename Config> class SizeClassAllocator32 {
 
     uptr Integral;
     uptr Fractional;
-    computePercentage(BlockSize * InUseBlocks, InUsePages * PageSize, &Integral,
+    computePercentage(BlockSize * InUseBlocks, InUseBytes, &Integral,
                       &Fractional);
     Str->append("  %02zu (%6zu): inuse/total blocks: %6zu/%6zu inuse/total "
                 "pages: %6zu/%6zu inuse bytes: %6zuK util: %3zu.%02zu%%\n",

diff  --git a/compiler-rt/lib/scudo/standalone/primary64.h b/compiler-rt/lib/scudo/standalone/primary64.h
index 8436f33c2fdcfc..ffcc22fea0c6ea 100644
--- a/compiler-rt/lib/scudo/standalone/primary64.h
+++ b/compiler-rt/lib/scudo/standalone/primary64.h
@@ -1185,7 +1185,7 @@ template <typename Config> class SizeClassAllocator64 {
 
     uptr Integral;
     uptr Fractional;
-    computePercentage(BlockSize * InUseBlocks, InUsePages * PageSize, &Integral,
+    computePercentage(BlockSize * InUseBlocks, InUseBytes, &Integral,
                       &Fractional);
     Str->append("  %02zu (%6zu): inuse/total blocks: %6zu/%6zu inuse/total "
                 "pages: %6zu/%6zu inuse bytes: %6zuK util: %3zu.%02zu%%\n",


        


More information about the llvm-commits mailing list