~mozillateam/firefox/firefox-beta.focal

« back to all changes in this revision

Viewing changes to debian/patches/armhf-mpscqueue-assert-less-strict.patch

  • Committer: Rico Tzschichholz
  • Date: 2020-07-06 09:27:17 UTC
  • Revision ID: ricotz@ubuntu.com-20200706092717-w89ummqh5yh6hpdw
* New upstream release from the beta channel (FIREFOX_79_0b4_BUILD1)
* Fix FTBFS on armhf
  - debian/patches/armhf-mpscqueue-assert-less-strict.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# HG changeset patch
 
2
# User Paul Adenot <paul@paul.cx>
 
3
# Date 1593779077 0
 
4
# Node ID decb3b5cc1c53429c4d139df0ace951eb66fbdef
 
5
# Parent  fcdd73fc3355ed8b29794b78159e4484c7b20f70
 
6
Bug 1649691 - Make static assert less strict in MPSCQueue.h. r=achronop
 
7
 
 
8
Differential Revision: https://phabricator.services.mozilla.com/D81818
 
9
 
 
10
diff --git a/dom/media/AsyncLogger.h b/dom/media/AsyncLogger.h
 
11
--- a/dom/media/AsyncLogger.h
 
12
+++ b/dom/media/AsyncLogger.h
 
13
@@ -79,16 +79,25 @@ class AsyncLogger {
 
14
     // A trace payload can be either:
 
15
     // - Begin - this marks the beginning of a temporal region
 
16
     // - End - this marks the end of a temporal region
 
17
     // - Complete - this is a timestamp and a length, forming complete a
 
18
     // temporal region
 
19
     TracingPhase mPhase;
 
20
   };
 
21
 #undef PADDING
 
22
+
 
23
+  // The goal here is to make it easy on the allocator. We pack a pointer in the
 
24
+  // message struct, and we still want to do power of two allocations to
 
25
+  // minimize allocator slop.
 
26
+#if !(defined(XP_LINUX) && !defined(MOZ_WIDGET_ANDROID) && \
 
27
+      (defined(__arm__) || defined(__aarch64__)))
 
28
+  static_assert(sizeof(MPSCQueue<TracePayload>::Message) <= PAYLOAD_TOTAL_SIZE,
 
29
+                "MPSCQueue internal allocations too big.");
 
30
+#endif
 
31
   // aLogModuleName is the name of the MOZ_LOG module.
 
32
   explicit AsyncLogger(const char* aLogModuleName,
 
33
                        AsyncLogger::AsyncLoggerOutputMode aMode =
 
34
                            AsyncLogger::AsyncLoggerOutputMode::PROFILER)
 
35
       : mThread(nullptr),
 
36
         mLogModule(aLogModuleName),
 
37
         mRunning(false),
 
38
         mMode(aMode) {}
 
39
diff --git a/dom/media/MPSCQueue.h b/dom/media/MPSCQueue.h
 
40
--- a/dom/media/MPSCQueue.h
 
41
+++ b/dom/media/MPSCQueue.h
 
42
@@ -12,48 +12,30 @@ namespace mozilla {
 
43
 // - Unbounded (uses a intrinsic linked list)
 
44
 // - Allocates on Push. Push can be called on any thread.
 
45
 // - Deallocates on Pop. Pop MUST always be called on the same thread for the
 
46
 // life-time of the queue.
 
47
 //
 
48
 // In our scenario, the producer threads are real-time, they can't block. The
 
49
 // consummer thread runs every now and then and empties the queue to a log
 
50
 // file, on disk.
 
51
-//
 
52
-// Having fixed size messages and jemalloc is probably not the fastest, but
 
53
-// allows having a simpler design, we count on the fact that jemalloc will get
 
54
-// the memory from a thread-local source most of the time.  We'll replace
 
55
-// this with a fixed-size ring buffer if this becomes an issue.
 
56
 const size_t MPSC_MSG_RESERVERD = sizeof(std::atomic<void*>);
 
57
 
 
58
 template <typename T>
 
59
 class MPSCQueue {
 
60
  public:
 
61
   struct Message {
 
62
     Message() { mNext.store(nullptr, std::memory_order_relaxed); }
 
63
     Message(const Message& aMessage) = delete;
 
64
     void operator=(const Message& aMessage) = delete;
 
65
 
 
66
     std::atomic<Message*> mNext;
 
67
     T data;
 
68
   };
 
69
 
 
70
-  // The goal here is to make it easy on the allocator. We pack a pointer in the
 
71
-  // message struct, and we still want to do power of two allocations to
 
72
-  // minimize allocator slop. The allocation size are going to be constant, so
 
73
-  // the allocation is probably going to hit the thread local cache in jemalloc,
 
74
-  // making it cheap and, more importantly, lock-free enough. This has been
 
75
-  // measured to be cheap and reliable enough, but will be replaced in the
 
76
-  // longer run.
 
77
-#if !(defined(ANDROID) && defined(__i386__))
 
78
-  static_assert(IsPowerOfTwo(sizeof(MPSCQueue<T>::Message)),
 
79
-                "MPSCQueue internal allocations must have a size that is a "
 
80
-                "power of two ");
 
81
-#endif
 
82
-
 
83
   // Creates a new MPSCQueue. Initially, the queue has a single sentinel node,
 
84
   // pointed to by both mHead and mTail.
 
85
   MPSCQueue()
 
86
       // At construction, the initial message points to nullptr (it has no
 
87
       // successor). It is a sentinel node, that does not contain meaningful
 
88
       // data.
 
89
       : mHead(new Message()), mTail(mHead.load(std::memory_order_relaxed)) {}
 
90
 
 
91