[PATCH] D23170: [compiler-rt] Fix memory allocator for dynamic address space

Kostya Serebryany via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 4 10:42:52 PDT 2016


kcc added inline comments.

================
Comment at: lib/sanitizer_common/sanitizer_allocator_primary64.h:114
@@ +113,3 @@
+    } else {
+      reg_beg = (((uptr)p - SpaceBeg()) & ~(kRegionSize - 1)) + SpaceBeg();
+      chunk_idx = GetChunkIdx((uptr)p - SpaceBeg(), size);
----------------
Implement a separate function GetRegBeg or something

================
Comment at: lib/sanitizer_common/sanitizer_allocator_primary64.h:115
@@ +114,3 @@
+      reg_beg = (((uptr)p - SpaceBeg()) & ~(kRegionSize - 1)) + SpaceBeg();
+      chunk_idx = GetChunkIdx((uptr)p - SpaceBeg(), size);
+    }
----------------
hide this logic inside GetChunkIdx

================
Comment at: lib/sanitizer_common/tests/sanitizer_allocator_test.cc:33
@@ -32,2 +32,3 @@
 #if SANITIZER_WINDOWS
-static const uptr kAllocatorSpace = 0x10000000000ULL;
+// Windows 64-bit is using a dynamically allocated address space.
+static const uptr kAllocatorSpace = ~(uptr)0;
----------------
Please explain why in the comment. 


https://reviews.llvm.org/D23170





More information about the llvm-commits mailing list