<div style="font-family: arial, helvetica, sans-serif; font-size: 10pt"><br><br><div class="gmail_quote">On Fri, Dec 7, 2012 at 9:28 PM, Alexey Samsonov <span dir="ltr"><<a href="mailto:samsonov@google.com" target="_blank">samsonov@google.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="font-family:arial,helvetica,sans-serif;font-size:10pt"><br><br><div class="gmail_quote"><div class="im">On Fri, Dec 7, 2012 at 1:40 AM, Kostya Serebryany <span dir="ltr"><<a href="mailto:kcc@google.com" target="_blank">kcc@google.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: kcc<br>
Date: Fri Dec  7 03:40:17 2012<br>
New Revision: <a href="tel:169593" value="+49169593" target="_blank">169593</a><br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=169593&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=169593&view=rev</a><br>
Log:<br>
[sanitizer] fix the build on ancient gcc which has stricter rules about what can be put on TLS. Long term, we absolutely must build the run-times with the fresh target clang<br></blockquote><div><br></div></div><div>If we only use clang, how would we know that gcc-build is broken (if we're still interested in it)?</div>
</div></div></blockquote><div><br></div><div>We may have separate bots for other compiler versions we care about. </div><div>But now the situation is like this: someone (e.g. me) runs the build on a local machine and it passes, then commits the code and everything is ok, </div>
<div>but 10 other different compilers (version, sets of warnings, etc) get broken.</div><div>OTOH, this probably happens with LLVM proper too and there is not much we can do.  :( </div><div><br></div><div>--kcc </div><div>
 </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="font-family:arial,helvetica,sans-serif;font-size:10pt"><div class="gmail_quote"><div><div class="h5">

<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Modified:<br>
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator.h<br>
<br>
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator.h?rev=169593&r1=169592&r2=169593&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator.h?rev=169593&r1=169592&r2=169593&view=diff</a><br>


==============================================================================<br>
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator.h (original)<br>
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator.h Fri Dec  7 03:40:17 2012<br>
@@ -97,25 +97,29 @@<br>
   AllocatorListNode *next;<br>
 };<br>
<br>
-struct AllocatorFreeList: IntrusiveList<AllocatorListNode> {<br>
-  // Move at most max_count chunks to other_free_list.<br>
-  void BulkAllocate(uptr max_count, AllocatorFreeList *other_free_list) {<br>
-    CHECK(!empty());<br>
-    CHECK(other_free_list->empty());<br>
-    if (size() <= max_count) {<br>
-      other_free_list->append_front(this);<br>
-      CHECK(empty());<br>
-    } else {<br>
-      for (uptr i = 0; i < max_count; i++) {<br>
-        AllocatorListNode *node = front();<br>
-        pop_front();<br>
-        other_free_list->push_front(node);<br>
-      }<br>
-      CHECK(!empty());<br>
+typedef IntrusiveList<AllocatorListNode> AllocatorFreeList;<br>
+<br>
+// Move at most max_count chunks from allocate_from to allocate_to.<br>
+// This function is better be a method of AllocatorFreeList, but we can't<br>
+// inherit it from IntrusiveList as the ancient gcc complains about non-PODness.<br>
+static inline void BulkMove(uptr max_count,<br>
+                            AllocatorFreeList *allocate_from,<br>
+                            AllocatorFreeList *allocate_to) {<br>
+  CHECK(!allocate_from->empty());<br>
+  CHECK(allocate_to->empty());<br>
+  if (allocate_from->size() <= max_count) {<br>
+    allocate_to->append_front(allocate_from);<br>
+    CHECK(allocate_from->empty());<br>
+  } else {<br>
+    for (uptr i = 0; i < max_count; i++) {<br>
+      AllocatorListNode *node = allocate_from->front();<br>
+      allocate_from->pop_front();<br>
+      allocate_to->push_front(node);<br>
     }<br>
-    CHECK(!other_free_list->empty());<br>
+    CHECK(!allocate_from->empty());<br>
   }<br>
-};<br>
+  CHECK(!allocate_to->empty());<br>
+}<br>
<br>
 // SizeClassAllocator64 -- allocator for 64-bit address space.<br>
 //<br>
@@ -164,8 +168,7 @@<br>
     if (region->free_list.empty()) {<br>
       PopulateFreeList(class_id, region);<br>
     }<br>
-    region->free_list.BulkAllocate(<br>
-        SizeClassMap::MaxCached(class_id), free_list);<br>
+    BulkMove(SizeClassMap::MaxCached(class_id), &region->free_list, free_list);<br>
   }<br>
<br>
   // Swallow the entire free_list for the given class_id.<br>
@@ -371,7 +374,7 @@<br>
     SpinMutexLock l(&sci->mutex);<br>
     EnsureSizeClassHasAvailableChunks(sci, class_id);<br>
     CHECK(!sci->free_list.empty());<br>
-    sci->free_list.BulkAllocate(SizeClassMap::MaxCached(class_id), free_list);<br>
+    BulkMove(SizeClassMap::MaxCached(class_id), &sci->free_list, free_list);<br>
   }<br>
<br>
   // Swallow the entire free_list for the given class_id.<br>
@@ -424,6 +427,7 @@<br>
<br>
   typedef SizeClassMap SizeClassMapT;<br>
   static const uptr kNumClasses = SizeClassMap::kNumClasses;  // 2^k <= 128<br>
+<br>
  private:<br>
   static const uptr kRegionSizeLog = SANITIZER_WORDSIZE == 64 ? 24 : 20;<br>
   static const uptr kRegionSize = 1 << kRegionSizeLog;<br>
@@ -433,7 +437,7 @@<br>
   struct SizeClassInfo {<br>
     SpinMutex mutex;<br>
     AllocatorFreeList free_list;<br>
-    char padding[kCacheLineSize - sizeof(uptr) - sizeof (AllocatorFreeList)];<br>
+    char padding[kCacheLineSize - sizeof(uptr) - sizeof(AllocatorFreeList)];<br>
   };<br>
   COMPILER_CHECK(sizeof(SizeClassInfo) == kCacheLineSize);<br>
<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div></div></div><span class="HOEnZb"><font color="#888888"><br><br clear="all"><div><br></div>-- <br><div>Alexey Samsonov, MSK</div><br>
</font></span></div>
</blockquote></div><br></div>