[PATCH] D38119: [XRay][compiler-rt] Use a hand-written circular buffer in BufferQueue

Dean Michael Berris via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 9 17:01:57 PDT 2017


dberris added inline comments.


================
Comment at: compiler-rt/trunk/lib/xray/xray_buffer_queue.h:45
+  std::unique_ptr<std::tuple<Buffer, bool>[]> Buffers;
+  size_t BufferCount;
+
----------------
dblaikie wrote:
> Shouldn't we be avoiding adding more standard library memory allocation to compiler-rt? (I thought that was one of the goals)
> 
> & that reminds me: I think the reason to avoid /all/ C++ standard library in compiler-rt is because of the possibility of mismatch between the standard library used to build compiler-rt and the one used to build user code. If theer is such a mismatch then the comdat functions will be chosen essentially at random and either the user code or the compiler-rt code using such a library function could end up quite broken. Right?
What's the harm with using std::unique_ptr<T[]> here? That it will use the standard allocator? Is there an alternative, should we be using raw pointers instead? Should we be allocating it with new[] or with malloc directly?


Repository:
  rL LLVM

https://reviews.llvm.org/D38119





More information about the llvm-commits mailing list