[compiler-rt] r183973 - [LSan] Use a typedef for frontier vector

Alexey Samsonov samsonov at google.com
Fri Jun 14 03:07:56 PDT 2013


Author: samsonov
Date: Fri Jun 14 05:07:56 2013
New Revision: 183973

URL: http://llvm.org/viewvc/llvm-project?rev=183973&view=rev
Log:
[LSan] Use a typedef for frontier vector

Modified:
    compiler-rt/trunk/lib/lsan/lsan_common.cc
    compiler-rt/trunk/lib/lsan/lsan_common.h
    compiler-rt/trunk/lib/lsan/lsan_common_linux.cc

Modified: compiler-rt/trunk/lib/lsan/lsan_common.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lsan_common.cc?rev=183973&r1=183972&r2=183973&view=diff
==============================================================================
--- compiler-rt/trunk/lib/lsan/lsan_common.cc (original)
+++ compiler-rt/trunk/lib/lsan/lsan_common.cc Fri Jun 14 05:07:56 2013
@@ -88,7 +88,7 @@ static inline bool CanBeAHeapPointer(upt
 // (tag = kIndirectlyLeaked). In the second case, there's no flood fill,
 // so frontier = 0.
 void ScanRangeForPointers(uptr begin, uptr end,
-                          InternalMmapVector<uptr> *frontier,
+                          Frontier *frontier,
                           const char *region_type, ChunkTag tag) {
   const uptr alignment = flags()->pointer_alignment();
   if (flags()->log_pointers)
@@ -117,7 +117,7 @@ void ScanRangeForPointers(uptr begin, up
 
 // Scan thread data (stacks and TLS) for heap pointers.
 static void ProcessThreads(SuspendedThreadsList const &suspended_threads,
-                           InternalMmapVector<uptr> *frontier) {
+                           Frontier *frontier) {
   InternalScopedBuffer<uptr> registers(SuspendedThreadsList::RegisterCount());
   uptr registers_begin = reinterpret_cast<uptr>(registers.data());
   uptr registers_end = registers_begin + registers.size();
@@ -184,7 +184,7 @@ static void ProcessThreads(SuspendedThre
   }
 }
 
-static void FloodFillTag(InternalMmapVector<uptr> *frontier, ChunkTag tag) {
+static void FloodFillTag(Frontier *frontier, ChunkTag tag) {
   while (frontier->size()) {
     uptr next_chunk = frontier->back();
     frontier->pop_back();
@@ -215,7 +215,7 @@ void CollectSuppressedCb::operator()(voi
 // Set the appropriate tag on each chunk.
 static void ClassifyAllChunks(SuspendedThreadsList const &suspended_threads) {
   // Holds the flood fill frontier.
-  InternalMmapVector<uptr> frontier(GetPageSizeCached());
+  Frontier frontier(GetPageSizeCached());
 
   if (flags()->use_globals)
     ProcessGlobalRegions(&frontier);

Modified: compiler-rt/trunk/lib/lsan/lsan_common.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lsan_common.h?rev=183973&r1=183972&r2=183973&view=diff
==============================================================================
--- compiler-rt/trunk/lib/lsan/lsan_common.h (original)
+++ compiler-rt/trunk/lib/lsan/lsan_common.h Fri Jun 14 05:07:56 2013
@@ -100,13 +100,15 @@ class LeakReport {
   InternalMmapVector<Leak> leaks_;
 };
 
+typedef InternalMmapVector<uptr> Frontier;
+
 // Platform-specific functions.
 void InitializePlatformSpecificModules();
-void ProcessGlobalRegions(InternalMmapVector<uptr> *frontier);
-void ProcessPlatformSpecificAllocations(InternalMmapVector<uptr> *frontier);
+void ProcessGlobalRegions(Frontier *frontier);
+void ProcessPlatformSpecificAllocations(Frontier *frontier);
 
 void ScanRangeForPointers(uptr begin, uptr end,
-                          InternalMmapVector<uptr> *frontier,
+                          Frontier *frontier,
                           const char *region_type, ChunkTag tag);
 
 // Callables for iterating over chunks. Those classes are used as template
@@ -118,11 +120,11 @@ void ScanRangeForPointers(uptr begin, up
 class ProcessPlatformSpecificAllocationsCb {
  public:
   explicit ProcessPlatformSpecificAllocationsCb(
-      InternalMmapVector<uptr> *frontier)
+      Frontier *frontier)
       : frontier_(frontier) {}
   void operator()(void *p) const;
  private:
-  InternalMmapVector<uptr> *frontier_;
+  Frontier *frontier_;
 };
 
 // Prints addresses of unreachable chunks.
@@ -151,11 +153,11 @@ class MarkIndirectlyLeakedCb {
 // Finds all chunk marked as kIgnored and adds their addresses to frontier.
 class CollectSuppressedCb {
  public:
-  explicit CollectSuppressedCb(InternalMmapVector<uptr> *frontier)
+  explicit CollectSuppressedCb(Frontier *frontier)
       : frontier_(frontier) {}
   void operator()(void *p) const;
  private:
-  InternalMmapVector<uptr> *frontier_;
+  Frontier *frontier_;
 };
 
 enum IgnoreObjectResult {

Modified: compiler-rt/trunk/lib/lsan/lsan_common_linux.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lsan_common_linux.cc?rev=183973&r1=183972&r2=183973&view=diff
==============================================================================
--- compiler-rt/trunk/lib/lsan/lsan_common_linux.cc (original)
+++ compiler-rt/trunk/lib/lsan/lsan_common_linux.cc Fri Jun 14 05:07:56 2013
@@ -53,8 +53,8 @@ void InitializePlatformSpecificModules()
 
 static int ProcessGlobalRegionsCallback(struct dl_phdr_info *info, size_t size,
                                         void *data) {
-  InternalMmapVector<uptr> *frontier =
-      reinterpret_cast<InternalMmapVector<uptr> *>(data);
+  Frontier *frontier =
+      reinterpret_cast<Frontier *>(data);
   for (uptr j = 0; j < info->dlpi_phnum; j++) {
     const ElfW(Phdr) *phdr = &(info->dlpi_phdr[j]);
     // We're looking for .data and .bss sections, which reside in writeable,
@@ -83,7 +83,7 @@ static int ProcessGlobalRegionsCallback(
 }
 
 // Scan global variables for heap pointers.
-void ProcessGlobalRegions(InternalMmapVector<uptr> *frontier) {
+void ProcessGlobalRegions(Frontier *frontier) {
   // FIXME: dl_iterate_phdr acquires a linker lock, so we run a risk of
   // deadlocking by running this under StopTheWorld. However, the lock is
   // reentrant, so we should be able to fix this by acquiring the lock before
@@ -114,7 +114,7 @@ void ProcessPlatformSpecificAllocationsC
 
 // Handle dynamically allocated TLS blocks by treating all chunks allocated from
 // ld-linux.so as reachable.
-void ProcessPlatformSpecificAllocations(InternalMmapVector<uptr> *frontier) {
+void ProcessPlatformSpecificAllocations(Frontier *frontier) {
   if (!flags()->use_tls) return;
   if (!linker) return;
   ForEachChunk(ProcessPlatformSpecificAllocationsCb(frontier));





More information about the llvm-commits mailing list