Commit Graph

164 Commits

Author SHA1 Message Date
Robert Widmann
da13d89c24 Move DummyQueue logic into buildTaskQueue 2018-05-29 21:58:27 -07:00
Robert Widmann
d7493dd0fa [NFC] Expose the TaskQueue as a Compilation Parameter
Shuffle the responsibility for creating the TaskQueue out of the
Compilation's internal job state object and into the driver.  Expose
a builder convenience function that handles the argument parsing.
2018-05-29 21:58:27 -07:00
Benjamin Herzog
ac10fb3462 [Driver] Added process information to emitted messages
When providing the -parseable-output flag to the swift compiler, it will provide json formatted messages about tasks that run.
I added some optional usage information in form of user time, system time and maxrss to the output. This can be used by other tools using the compiler to get some insights about time and memory usage.
Since the output does not longer match processes run (in batch mode), I also added a real_pid field so the client could reason about jobs that belong together if needed.

rdar://39798231
2018-05-25 13:12:57 -07:00
Graydon Hoare
a0b4f3f481 Merge pull request #16492 from graydon/rdar-39981525-batch-mode-show-every-job-via-quasi-pids
[BatchMode] <rdar://39981525> Emit parseable output for each job, using quasi-PIDs.
2018-05-10 23:03:52 -07:00
Jordan Rose
606ee29b74 [Driver] -enable-batch-mode implies -continue-building-after-errors (#16521)
The logic in 46b8ad3 to avoid putting certain diagnostics into
serialized diagnostic files only makes sense if

1. every diagnostic emitted in file A.swift while processing a
   different file B.swift would be emitted if we processed A.swift on
   its own

2. we actually do process A.swift on its own in the same build,
   or have previously done an incremental build and produced the same
   diagnostic

But the latter isn't actually guaranteed: if one batch job exits with
a failure status, the driver will exit as well, assuming there's no
point in continuing. Fortunately, we do have a flag that overrides
this behavior, -continue-building-after-errors.

(As noted in the patch, -continue-building-after-errors isn't *exactly*
what we want. But it's conservatively correct.)
2018-05-10 21:44:12 -07:00
Graydon Hoare
39fdf5d4e5 [BatchMode] <rdar://39981525> Emit parseable output for each job, using quasi-PIDs. 2018-05-10 20:34:33 -07:00
Graydon Hoare
c1682fa465 [Driver] <rdar://39504759> Continue demultiplexing subprocess output after initial read. 2018-04-18 11:52:11 -07:00
Nathan Hawes
0a4204e99f [Driver] Add -driver-filelist-threshold to set the number of inputs beyond which filelists are used
When generating a compiler invocation in driver::createCompilerInvocation()
we end up using filelists if the number of inputs is > 128 (to work around
command line arg limits). We never actually write them out though, and so
fail when parsing the frontend arguments that reference them.

As this function is called frequently by SourceKit and command line limits
aren't a concern here, this patch makes the 128 threshold value configurable
via a new -driver-filelist-threshold option. This is set to its maximum value
in driver::createCompilerInvocation() to ensure filelists aren't used. This
new option makes the existing -driver-use-filelists (that forces filelists to
be used) redundant as it's now equivalent to -driver-filelist-threshold=0.

Resolves rdar://problem/38231888
2018-04-12 05:24:03 -07:00
Rintaro Ishizaki
2cec8dfc99 [Driver] Factor out build-record filename construction
* Retrive filename for read and write at the same time.
* Read LastBuildTime directly from the build record.
2018-04-03 20:39:55 +09:00
Rintaro Ishizaki
18ceef56e3 [Driver] Use separated build record file for '-emit-module' only mode
* In full compilation '-c' with '-emit-module', output duplicated build
  record file for full compilation *and* emit module ('~moduleonly') mode.
* In '-emit-module' only mode, use '~moduleonly' build record.
2018-04-02 21:04:13 +09:00
David Ungar
4fa3001bd1 Harden compiler against -num-threads and -enable-batch-mode. 2018-03-26 17:04:31 -07:00
David Ungar
807dd5864e Renamed swift::types to swift::file_types. 2018-03-22 08:40:06 -07:00
David Ungar
e3535ff3d8 Merge pull request #15371 from davidungar/PR-18-11-fileMap-redo
[Batch mode] Write out filemaps for supplementary outputs.
2018-03-21 17:05:36 -07:00
David Ungar
90773d298c Write out filemaps for supplementary outputs.
Add -driver-force-one-batch-repartition and enhance  batch_mode-overlong_argv test.
2018-03-20 09:42:13 -07:00
Pavel Yaskevich
fd3610b8c0 Revert "[Batch mode] Write supplementary output file map. rdar://problem/38157859" 2018-03-17 21:01:46 -07:00
David Ungar
a0cd1c57bc Merge pull request #15013 from davidungar/PR-18-11-fileMap
[Batch mode] Write supplementary output file map. rdar://problem/38157859
2018-03-16 17:38:53 -07:00
David Ungar
919c224d5a Handle index file path differently. 2018-03-15 22:00:16 -07:00
David Ungar
3a0acdaf0c Fix supplementary output filemap generation to account for CommandOutput. 2018-03-15 21:28:56 -07:00
David Ungar
9dcbaa38f7 Factor out writeOutputFileMap 2018-03-15 13:54:43 -07:00
David Ungar
e499aeda9b Redo force repartion flag and add a test. 2018-03-13 17:20:12 -07:00
David Ungar
3570af7476 Fixes 2018-03-12 15:40:08 -07:00
David Ungar
180bdd61be Implement -index-file-path 2018-03-11 11:48:21 -07:00
David Ungar
ba1a714dbe Formatting 2018-03-10 16:10:38 -08:00
David Ungar
c9db72c1cb Debug macro 2018-03-09 19:58:20 -08:00
David Ungar
65267c6568 WIP 2018-03-09 15:45:38 -08:00
David Ungar
adfda9bbc8 Add -driver-force-one-batch-repartition and enhance batch_mode-overlong_argv test. 2018-03-09 13:54:44 -08:00
David Ungar
798dd7b490 Write out filemaps for supplementary outputs. 2018-03-09 13:54:44 -08:00
Graydon Hoare
fa830fe5aa [BatchMode] Preserve invariant that shuffled batches are subsequences of inputs. 2018-03-09 10:13:04 -08:00
Sho Ikeda
cea6c03eb2 [gardening] Use !empty() over size() > 0 2018-03-08 09:21:09 +09:00
David Ungar
90d2740817 Merge pull request #14961 from davidungar/PR-18-10-HHH
[Batch mode] Restore -### functionality for batch-mode by extending OutputLevel.
2018-03-06 09:54:03 -08:00
Graydon Hoare
6c9029ead8 [BatchMode] Fix rdar://38123690 a little more robustly. 2018-03-05 13:43:30 -08:00
Graydon Hoare
eb315e74ed [BatchMode] Temporarily cap max batch size, fixing rdar://38123690 2018-03-05 12:28:48 -08:00
Graydon Hoare
899c1f5b87 [Driver] Handle failure-to-exec somewhat more politely, rdar://37865437. 2018-03-05 12:28:48 -08:00
David Ungar
17a81f6981 Restore -### functionality for batch-mode by extending OutputLevel. 2018-03-05 11:07:20 -08:00
Graydon Hoare
7981714214 [BatchMode] Make driver report exits per-batch, not per-constituent. 2018-03-02 00:32:30 -08:00
Graydon Hoare
263c4c54d5 [BatchMode] Preserve intra-batch order, add a seed mode. 2018-02-20 18:31:41 -08:00
Graydon Hoare
57fe9ee57a [BatchMode] Add driver::PerformJobsState logic for BatchJobs. 2018-02-15 15:38:09 -08:00
Graydon Hoare
3d9ce0afb9 [BatchMode] Store -{enable,disable}-batch-mode as a flag in Compilation. 2018-02-15 15:38:09 -08:00
Graydon Hoare
a2c718777d [BatchMode] Pass OutputInfo to Compilation on construction. 2018-02-15 15:38:08 -08:00
Graydon Hoare
ef61f721d4 [BatchMode] Change all CommandOutputs to use a shared OutputFileMap. 2018-02-09 14:08:50 -08:00
Graydon Hoare
d139ab2968 [BatchMode] Expand lifetime of ToolChain, pass reference to it to Compilation. 2018-01-24 10:31:19 -08:00
Graydon Hoare
d74c1a512a [BatchMode] Make InvocationInfo and Job support multiple FilelistInfos, NFC. 2018-01-19 15:15:08 -08:00
Graydon Hoare
22775c87a9 [BatchMode] Add FilelistInfo::WhichFiles::PrimaryInputs, NFC. 2018-01-19 14:16:20 -08:00
Graydon Hoare
0f09a95679 [BatchMode] Change FiellistInfo::WhichFiles to an enum class, NFC. 2018-01-19 14:05:42 -08:00
Graydon Hoare
173e702da2 [Stats] Add a pair of counters to track failed processes. 2017-11-08 19:53:36 -08:00
Jordan Rose
47872d9190 [Driver] Transfer all ownership of Actions to the Compilation.
Previously, Actions were responsible for freeing their inputs...
except for the ones that weren't. Or the ones that were supposed
to, but then they needed to share an input, so they couldn't anymore.
If this sounds ridiculous, you're right; now Actions are just
immediately allocated and owned by the Compilation.

The graph structure of the actions is still useful for some things; in
particular, "top-level" actions get to put their outputs somewhere
permanent rather than TMPDIR. But I expect these things to get cleaned
up in the future too.
2017-08-11 21:09:34 -07:00
Jordan Rose
64df9b1edc [Driver] Actually free Actions instead of just leaking them.
Fixes rdar://problem/32518867, though in a fairly messy way. Next
commit will clean this up again.
2017-08-11 21:09:34 -07:00
Jordan Rose
a875d8c7c7 [Driver] Preserve filelists when a subprocess crashes. (#9849)
This should make it easier to rerun crashed jobs that use filelists;
previously you'd have to run the top-level driver command again with
-save-temps. I didn't want to save /all/ temporary files because that
often includes things like .o files, which could fill up your disk
pretty quickly. But we can always tweak this later.
2017-05-22 17:14:20 -07:00
practicalswift
431e5a1440 [gardening] Use consistent end of namespace comments 2017-04-20 13:47:10 +02:00
Graydon Hoare
0245c83c4b [Stats] Add -stats-output-dir, wire UnifiedStatsReporter into place. 2017-04-03 18:08:59 -07:00