[llvm-commits] [compiler-rt] r158076 - /compiler-rt/trunk/lib/asan/asan_allocator.cc

Kostya Serebryany kcc at google.com
Wed Jun 6 08:30:55 PDT 2012


Author: kcc
Date: Wed Jun  6 10:30:55 2012
New Revision: 158076

URL: http://llvm.org/viewvc/llvm-project?rev=158076&view=rev
Log:
[asan] more compaction for allocator

Modified:
    compiler-rt/trunk/lib/asan/asan_allocator.cc

Modified: compiler-rt/trunk/lib/asan/asan_allocator.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_allocator.cc?rev=158076&r1=158075&r2=158076&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_allocator.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_allocator.cc Wed Jun  6 10:30:55 2012
@@ -157,11 +157,11 @@
 };
 
 struct ChunkBase {
-  u8   chunk_state;
-  u8   size_class;
+  uptr  chunk_state : 8;
+  uptr  size_class  : 8;
+  uptr  alloc_tid   : 24;
+  uptr  free_tid    : 24;
   u32  offset;  // User-visible memory starts at this+offset (beg()).
-  u32  alloc_tid;
-  u32  free_tid;
   uptr used_size;  // Size requested by the user.
   AsanChunk *next;
 
@@ -707,8 +707,8 @@
   // Printf("Deallocate %p\n", ptr);
   AsanChunk *m = PtrToChunk((uptr)ptr);
 
-  // Flip the state atomically to avoid race on double-free.
-  u8 old_chunk_state = AtomicExchange(&m->chunk_state, CHUNK_QUARANTINE);
+  // Flip the chunk_state atomically to avoid race on double-free.
+  u8 old_chunk_state = AtomicExchange((u8*)m, CHUNK_QUARANTINE);
 
   if (old_chunk_state == CHUNK_QUARANTINE) {
     AsanReport("ERROR: AddressSanitizer attempting double-free on %p:\n", ptr);





More information about the llvm-commits mailing list