[PATCH] D49363: [XRay][compiler-rt] Segmented Array: Simplify and Optimise

Noel Grandin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 16 04:48:07 PDT 2018


grandinj added inline comments.


================
Comment at: compiler-rt/lib/xray/xray_segmented_array.h:34
 /// backing store but will not free the memory. The parameter N defines how many
-/// elements of T there should be in a single block.
-///
-/// We compute the least common multiple of the size of T and the cache line
-/// size, to allow us to maximise the number of T objects we can place in
-/// cache-line multiple sized blocks. To get back the number of T's, we divide
-/// this least common multiple by the size of T.
-template <class T,
-          size_t N = lcm(next_pow2(sizeof(T)), kCacheLineSize) / sizeof(T)>
-struct Array {
-  static constexpr size_t ChunkSize = N;
-  static constexpr size_t ElementStorageSize = next_pow2(sizeof(T));
-  static constexpr size_t AllocatorChunkSize = ElementStorageSize * ChunkSize;
-  using AllocatorType = Allocator<AllocatorChunkSize>;
-  static_assert(std::is_trivially_destructible<T>::value,
-                "T must be trivially destructible.");
+/// elements of T there should be in a single segment of the array.
+template <class T> class Array {
----------------
Parameter N seems to be dead?


https://reviews.llvm.org/D49363





More information about the llvm-commits mailing list