@@ -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,18 @@ 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
- pageInQueue.queueWork (
388
- [=]() {
389
- DeferredFiles files = deferred;
390
- multiThreadedPageInBackground (files);
391
- },
392
- reap);
380
+ pageInQueue.queueWork ([=]() {
381
+ DeferredFiles files = deferred;
382
+ multiThreadedPageInBackground (files);
383
+ });
393
384
}
394
385
395
386
static InputFile *processFile (std::optional<MemoryBufferRef> buffer,
@@ -491,7 +482,7 @@ static InputFile *processFile(std::optional<MemoryBufferRef> buffer,
491
482
}
492
483
493
484
if (archiveContents)
494
- archiveContents->emplace_back ( path, isLazy, *mb);
485
+ archiveContents->push_back ({ path, isLazy, *mb} );
495
486
if (!hasObjCSection (*mb))
496
487
continue ;
497
488
if (Error e = file->fetch (c, " -ObjC" ))
@@ -568,7 +559,7 @@ static void deferFile(StringRef path, bool isLazy, DeferredFiles &deferred) {
568
559
if (!buffer)
569
560
return ;
570
561
if (config->readThreads )
571
- deferred.emplace_back ( path, isLazy, *buffer);
562
+ deferred.push_back ({ path, isLazy, *buffer} );
572
563
else
573
564
processFile (buffer, nullptr , path, LoadType::CommandLine, isLazy);
574
565
}
0 commit comments