[compiler-rt] e851aeb - scudo: Re-order Allocator fields for improved performance. NFCI.

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 28 11:52:09 PDT 2020


Author: Peter Collingbourne
Date: 2020-09-28T11:51:45-07:00
New Revision: e851aeb0a5084d968d6384fbc2257bbe05dcdacb

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

LOG: scudo: Re-order Allocator fields for improved performance. NFCI.

Move smaller and frequently-accessed fields near the beginning
of the data structure in order to improve locality and reduce
the number of instructions required to form an access to those
fields. With this change I measured a ~5% performance improvement on
BM_malloc_sql_trace_default on aarch64 Android devices (Pixel 4 and
DragonBoard 845c).

Differential Revision: https://reviews.llvm.org/D88350

Added: 
    

Modified: 
    compiler-rt/lib/scudo/standalone/combined.h

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/scudo/standalone/combined.h b/compiler-rt/lib/scudo/standalone/combined.h
index 8be6ae820c89..e39871dc4704 100644
--- a/compiler-rt/lib/scudo/standalone/combined.h
+++ b/compiler-rt/lib/scudo/standalone/combined.h
@@ -950,12 +950,6 @@ class Allocator {
 
   static const uptr MaxTraceSize = 64;
 
-  GlobalStats Stats;
-  TSDRegistryT TSDRegistry;
-  PrimaryT Primary;
-  SecondaryT Secondary;
-  QuarantineT Quarantine;
-
   u32 Cookie;
 
   struct {
@@ -968,6 +962,12 @@ class Allocator {
     u32 QuarantineMaxChunkSize; // quarantine_max_chunk_size
   } Options;
 
+  GlobalStats Stats;
+  PrimaryT Primary;
+  SecondaryT Secondary;
+  QuarantineT Quarantine;
+  TSDRegistryT TSDRegistry;
+
 #ifdef GWP_ASAN_HOOKS
   gwp_asan::GuardedPoolAllocator GuardedAlloc;
 #endif // GWP_ASAN_HOOKS


        


More information about the llvm-commits mailing list