[llvm-commits] [PATCH] New sanitizer allocator that works in 32-bits. Only basic functionality so far.

Kostya Serebryany kcc at google.com
Thu Dec 6 04:52:44 PST 2012


  r169496, thanks!


================
Comment at: sanitizer_common/sanitizer_allocator.h:319
@@ +318,3 @@
+// A Region looks like this:
+// UserChunk1 .. UserChunkN <gap> MetaChunk1 .. MetaChunkN
+//
----------------
Dmitry Vyukov wrote:
> It's MetaChunkN .. MetaChunk1
done

================
Comment at: sanitizer_common/sanitizer_allocator.h:337
@@ +336,3 @@
+    CHECK(CanAllocate(size, alignment));
+    return AllocateBySizeClass(SizeClassMap::ClassID(size));
+  }
----------------
Dmitry Vyukov wrote:
> This does not provide requested alignment.
done

================
Comment at: sanitizer_common/sanitizer_allocator.h:346
@@ +345,3 @@
+  void *GetMetaData(void *p) {
+    uptr mem = reinterpret_cast<uptr>(p);
+    uptr beg = ComputeRegionBeg(mem);
----------------
Dmitry Vyukov wrote:
> CHECK(PointerIsMine(p));
done

================
Comment at: sanitizer_common/sanitizer_allocator.h:394
@@ +393,3 @@
+    AllocatorFreeList free_list;
+    char padding[kCacheLineSize - sizeof(uptr) - sizeof (AllocatorFreeList)];
+  };
----------------
Dmitry Vyukov wrote:
> sizeof(SpinMutex)
Actually, no. sizeof(SpinMutex) is one, but there is an alignment. 
The COMPILER_CHECK below makes sure we did not screw up

================
Comment at: sanitizer_common/sanitizer_allocator.h:451
@@ +450,3 @@
+  u8 possible_regions_[kNumPossibleRegions];
+  SizeClassInfo size_class_info_array_[kNumClasses];
+};
----------------
Dmitry Vyukov wrote:
> SizeClassAllocator32 must be cache-line aligned itself
Added a comment. I am not sure how to force alignment on a class reliably. 


http://llvm-reviews.chandlerc.com/D183



More information about the llvm-commits mailing list