@@ -299,17 +299,17 @@ class SerialBackgroundQueue {
299
299
std::mutex mutex;
300
300
301
301
public:
302
- void queueWork (std::function<void ()> work, bool reap ) {
302
+ void queueWork (std::function<void ()> work) {
303
303
mutex.lock ();
304
- if (running && ( queue.empty () || reap )) {
304
+ if (running && queue.empty ()) {
305
305
mutex.unlock ();
306
306
running->join ();
307
307
mutex.lock ();
308
308
delete running;
309
309
running = nullptr ;
310
310
}
311
311
312
- if (!reap ) {
312
+ if (work ) {
313
313
queue.emplace_back (std::move (work));
314
314
if (!running)
315
315
running = new std::thread ([&]() {
@@ -332,11 +332,6 @@ class SerialBackgroundQueue {
332
332
}
333
333
};
334
334
335
- #ifndef NDEBUG
336
- #include < iomanip>
337
- #include < iostream>
338
- #endif
339
-
340
335
// Most input files have been mapped but not yet paged in.
341
336
// This code forces the page-ins on multiple threads so
342
337
// the process is not stalled waiting on disk buffer i/o.
@@ -374,22 +369,19 @@ void multiThreadedPageInBackground(DeferredFiles &deferred) {
374
369
#ifndef NDEBUG
375
370
auto dt = high_resolution_clock::now () - t0;
376
371
if (Process::GetEnv (" LLD_MULTI_THREAD_PAGE" ))
377
- std::cerr << " multiThreadedPageIn " << totalBytes << " /"
378
- << numDeferedFilesTouched << " /" << deferred.size () << " /"
379
- << std::setprecision (4 )
380
- << duration_cast<milliseconds>(dt).count () / 1000 . << " \n " ;
372
+ llvm::dbgs () << " multiThreadedPageIn " << totalBytes << " /"
373
+ << numDeferedFilesTouched << " /" << deferred.size () << " /"
374
+ << duration_cast<milliseconds>(dt).count () / 1000 . << " \n " ;
381
375
#endif
382
376
}
383
377
384
- static void multiThreadedPageIn (const DeferredFiles &deferred,
385
- bool reap = false ) {
378
+ static void multiThreadedPageIn (const DeferredFiles &deferred) {
386
379
static SerialBackgroundQueue pageInQueue;
387
380
pageInQueue.queueWork (
388
381
[=]() {
389
382
DeferredFiles files = deferred;
390
383
multiThreadedPageInBackground (files);
391
- },
392
- reap);
384
+ });
393
385
}
394
386
395
387
static InputFile *processFile (std::optional<MemoryBufferRef> buffer,
@@ -491,7 +483,7 @@ static InputFile *processFile(std::optional<MemoryBufferRef> buffer,
491
483
}
492
484
493
485
if (archiveContents)
494
- archiveContents->emplace_back ( path, isLazy, *mb);
486
+ archiveContents->push_back ({ path, isLazy, *mb} );
495
487
if (!hasObjCSection (*mb))
496
488
continue ;
497
489
if (Error e = file->fetch (c, " -ObjC" ))
@@ -568,7 +560,7 @@ static void deferFile(StringRef path, bool isLazy, DeferredFiles &deferred) {
568
560
if (!buffer)
569
561
return ;
570
562
if (config->readThreads )
571
- deferred.emplace_back ( path, isLazy, *buffer);
563
+ deferred.push_back ({ path, isLazy, *buffer} );
572
564
else
573
565
processFile (buffer, nullptr , path, LoadType::CommandLine, isLazy);
574
566
}
0 commit comments