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

Vincent Lee via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 10 18:30:32 PST 2021


thevinster updated this revision to Diff 393648.
thevinster added a comment.

Use threadpool


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115416

Files:
  lld/MachO/Writer.cpp


Index: lld/MachO/Writer.cpp
===================================================================
--- lld/MachO/Writer.cpp
+++ lld/MachO/Writer.cpp
@@ -29,6 +29,7 @@
 #include "llvm/Support/MathExtras.h"
 #include "llvm/Support/Parallel.h"
 #include "llvm/Support/Path.h"
+#include "llvm/Support/ThreadPool.h"
 #include "llvm/Support/TimeProfiler.h"
 #include "llvm/Support/xxhash.h"
 
@@ -64,6 +65,7 @@
 
   template <class LP> void run();
 
+  ThreadPool writerThreadPool;
   std::unique_ptr<FileOutputBuffer> &buffer;
   uint64_t addr = 0;
   uint64_t fileOff = 0;
@@ -1147,8 +1149,8 @@
   sortSegmentsAndSections();
   createLoadCommands<LP>();
   finalizeAddresses();
+  writerThreadPool.async(writeMapFile);
   finalizeLinkEditSegment();
-  writeMapFile();
   writeOutputFile();
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D115416.393648.patch
Type: text/x-patch
Size: 788 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211211/a9d59fca/attachment.bin>


More information about the llvm-commits mailing list