[PATCH] D115416: [lld-macho] Prevent writing map files on the critical path

Vy Nguyen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 13 18:28:45 PST 2021


oontvoo added inline comments.


================
Comment at: lld/MachO/Writer.cpp:1040
   };
-  parallelForEach(linkEditSections, [](LinkEditSection *osec) {
-    if (osec)
-      osec->finalizeContents();
-  });
+  SmallVector<std::shared_future<void>> threadFutures;
+  for (LinkEditSection *osec : linkEditSections) {
----------------



================
Comment at: lld/MachO/Writer.cpp:1041
+  SmallVector<std::shared_future<void>> threadFutures;
+  for (LinkEditSection *osec : linkEditSections) {
+    threadFutures.emplace_back(writerThreadPool.async(
----------------
nit: no brace


================
Comment at: lld/MachO/Writer.cpp:1103-1114
+  ThreadPool writeUuidThreadPool;
+
   ArrayRef<uint8_t> data{buffer->getBufferStart(), buffer->getBufferEnd()};
   unsigned chunkCount = parallel::strategy.compute_thread_count() * 10;
   // Round-up integer division
   size_t chunkSize = (data.size() + chunkCount - 1) / chunkCount;
   std::vector<ArrayRef<uint8_t>> chunks = split(data, chunkSize);
----------------
why is this change needed?



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D115416/new/

https://reviews.llvm.org/D115416



More information about the llvm-commits mailing list