[lld] [lld][MachO]Multi-threaded i/o. Twice as fast linking a large project. (PR #147134)
John Holdsworth via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 15 08:46:03 PDT 2025
================
@@ -1295,6 +1394,28 @@ static void createFiles(const InputArgList &args) {
break;
}
}
+
+ if (config->readThreads) {
+ multiThreadedPageIn(deferredFiles);
+
+ DeferredFiles archiveContents;
+ std::vector<ArchiveFile *> archives;
+ for (auto &file : deferredFiles) {
+ auto inputFile = processFile(file.buffer, &archiveContents, file.path,
+ LoadType::CommandLine, file.isLazy);
+ if (ArchiveFile *archive = dyn_cast<ArchiveFile>(inputFile))
+ archives.push_back(archive);
+ }
+
+ if (!archiveContents.empty()) {
+ multiThreadedPageIn(archiveContents);
+ for (auto *archive : archives)
+ archive->addLazySymbols();
+ }
+
+ // reap threads
+ // multiThreadedPageIn();
----------------
johnno1962 wrote:
I tried various attempts at creating a separate reap function but it shares state with the function to add work and it was all a bit messy involving top level variables. I'm not sure passing an empty array is so obscure if the empty array has an informative name as in the new commit. I'm open to whether reaping is necessary but I'm nervous about pointers to unowned memory buffers going out of scope though this doesn't seem to happen in practice. If you can't accept the dummy value approach I can just remove the reaping.
https://github.com/llvm/llvm-project/pull/147134
More information about the llvm-commits
mailing list