[PATCH] D39473: [sanitizers] Add init function to set alignment of low level allocator

Walter Lee via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 20 12:40:47 PST 2017


waltl marked 2 inline comments as done.
waltl added inline comments.


================
Comment at: compiler-rt/lib/sanitizer_common/sanitizer_allocator.cc:210
+  if (low_level_alloc_min_alignment < alignment)
+    low_level_alloc_min_alignment = alignment;
+}
----------------
alekseyshl wrote:
> Did you really mean that alignment can only go up? How about this:
> 
> constexpr uptr kLowLevelAllocatorDefaultAlignment = 8;
> static uptr low_level_alloc_min_alignment = kLowLevelAllocatorDefaultAlignment;
> ...
> low_level_alloc_min_alignment = Max(alignment, kLowLevelAllocatorDefaultAlignment);
Done.  Not sure if the final kLowLevelAllocatorDefaultAlignment is a typo, but I changed it to low_level_alloc_min_alignment so that if SetLowLevelAllocateMinAlignment is called multiple times, we get a max of all the input alignments.



https://reviews.llvm.org/D39473





More information about the llvm-commits mailing list