Revert "PECOFF: Don't parse files in .drectve asynchronously."
authorRui Ueyama <ruiu@google.com>
Sun, 1 Mar 2015 20:48:14 +0000 (20:48 +0000)
committerRui Ueyama <ruiu@google.com>
Sun, 1 Mar 2015 20:48:14 +0000 (20:48 +0000)
This reverts commit r228955. Previously files appear in a .drectve
section are parsed synchronously to avoid threading issues. I believe
it's now safe to do that asynchronously.

llvm-svn: 230905

lld/lib/Driver/WinLinkDriver.cpp

index 79c5733..ead06ad 100644 (file)
@@ -1341,8 +1341,10 @@ bool WinLinkDriver::parse(int argc, const char *argv[],
 
   // Add the input files to the linking context.
   for (std::unique_ptr<File> &file : files) {
-    if (isReadingDirectiveSection)
-      file.get()->parse();
+    if (isReadingDirectiveSection) {
+      File *f = file.get();
+      ctx.getTaskGroup().spawn([f] { f->parse(); });
+    }
     ctx.getNodes().push_back(llvm::make_unique<FileNode>(std::move(file)));
   }
 
@@ -1355,8 +1357,10 @@ bool WinLinkDriver::parse(int argc, const char *argv[],
   // Add the library files to the library group.
   for (std::unique_ptr<File> &file : libraries) {
     if (!hasLibrary(ctx, file.get())) {
-      if (isReadingDirectiveSection)
-        file.get()->parse();
+      if (isReadingDirectiveSection) {
+        File *f = file.get();
+        ctx.getTaskGroup().spawn([f] { f->parse(); });
+      }
       ctx.addLibraryFile(llvm::make_unique<FileNode>(std::move(file)));
     }
   }