Commit Graph

114 Commits

Author SHA1 Message Date
Robert Widmann
d15bcc3670 Remove Argument Parsing For Source Ranges 2021-01-13 17:12:27 -08:00
Robert Widmann
35c45949a2 Remove IncrementalSchemeComparator 2021-01-13 16:49:19 -08:00
Robert Widmann
859b87fd8c Move The Last Pieces for Cross-Module Incremental Builds
We're going to play a dirty, dirty trick - but it'll make our users'
lives better in the end so stick with me here.

In order to build up an incremental compilation, we need two sources of
dependency information:

1) "Priors" - Swiftdeps with dependency information from the past
   build(s)
2) "Posteriors" - Swiftdeps with dependencies from after we rebuild the
   file or module or whatever

With normal swift files built in incremental mode, the priors are given by the
swiftdeps files which are generated parallel to a swift file and usually
placed in the build directory alongside the object files. Because we
have entries in the output file map, we can always know where these
swiftdeps files are. The priors are integrated by the driver and then
the build is scheduled. As the build runs and jobs complete, their
swiftdeps are reloaded and re-integrated. The resulting changes are then
traversed and more jobs are scheduled if necessary. These give us the
posteriors we desire.

A module flips this on its head. The swiftdeps information serialized
in a module functions as the *posterior* since the driver consuming the
module has no way of knowing how to rebuild the module, and because its
dependencies are, for all intents and purposes, fixed in time. The
missing piece of the puzzle is the priors. That is, we need some way of
knowing what the "past" interface of the module looked like so we can
compare it to the "present" interface. Moreover, we need to always know
where to look for these priors.

We solve this problem by serializing a file alongside the build record:
the "external" build record. This is given by a... creative encoding
of multiple source file dependency graphs into a single source file
dependency graph. The rough structure of this is:

   SourceFile => interface <BUILD_RECORD>.external
   | - Incremental External Dependency => interface <MODULE_1>.swiftmodule
   | | - <dependency> ...
   | | - <dependency> ...
   | | - <dependency> ...
   | - Incremental External Dependency => interface <MODULE_2>.swiftmodule
   | | - <dependency> ...
   | | - <dependency> ...
   | - Incremental External Dependency => interface <MODULE_3>.swiftmodule
   | - ...

Sorta, `cat`'ing a bunch of source file dependency graphs together but
with incremental external dependency nodes acting as glue.

Now for the trick:

We have to unpack this structure and integrate it to get our priors.
This is easy. The tricky bit comes in integrate itself. Because the
top-level source file node points directly at the external build record,
not the original swift modules that defined these dependency nodes, we
swap the key it wants to use (the external build record) for the
incremental external dependency acting as the "parent" of the dependency
node. We do this by following the arc we carefully laid down in the
structure above.

For rdar://69595010
Goes a long way towards rdar://48955139, rdar://64238133
2020-12-10 18:45:21 -08:00
Robert Widmann
905c3d8830 [Gardening] Document Compilation::Result 2020-12-09 19:28:50 -08:00
Robert Widmann
d4e76d0a47 [NFC] Use Result::code to Simplify Some Callsites 2020-12-09 19:28:50 -08:00
Robert Widmann
d4022929c1 [NFC] Mark Result as move-only
This required dropping some superfluous 'const' qualification in the module dependency graph.
2020-12-09 19:28:50 -08:00
Robert Widmann
3ecb0b0b06 [NFC] Move "HadAbnormalExit" Flag Into Compilation::Result 2020-12-09 19:25:56 -08:00
Robert Widmann
d815e2724a [NFC] Add Compilation::Result
In order to extract the module dependency graph from the compilation the driver just ran, define a separate semantic type to hold a result code and the graph itself.
2020-12-09 19:25:56 -08:00
Robert Widmann
b0f0587963 Keep a Cache of Externally-Dependent Jobs
A more durable form of #34218. Keep a side cache of externally-dependent
jobs for now. This ensures our pseudo-Jobs don't get prematurely
deallocated before the tracing machinery has had a chance to report the
structure of the Job graph.

rdar://70053563
2020-10-07 10:39:17 -07:00
Robert Widmann
964f640636 Drop "Private Deps" Flag
In order for type body fingerprints to work, these declarations must always be included. Drop the ability to turn this off.
2020-10-01 14:40:45 -07:00
Robert Widmann
74765a8ba8 Remove Type Body Fingerprints Flags
This infrastructure has more than proven itself. Drop the code paths and tests supporting the status quo.
2020-10-01 13:09:00 -07:00
Robert Widmann
48415ad228 [NFC] Stage in driver flags for experimental cross-module incremental builds 2020-09-24 17:10:57 -06:00
Robert Widmann
14188f4428 Remove ~moduleonly Duplicate of Compilation Record
We thought we would need this while exploring  certain pre-build optimizations a la rdar://problem/37725110. This information was never used.
2020-09-24 11:42:06 -06:00
Florian Friedrich
67073c7a67 Fix typo in comparison in comments and help text 2020-07-09 18:05:25 +02:00
Varun Gandhi
fea589e470 [NFC] Remove redundant includes for llvm/ADT/DenseSet.h. 2020-05-31 13:07:45 -07:00
Slava Pestov
368d47429d Frontend: Remove coarse-grained dependency graph implementation 2020-04-29 16:55:53 -04:00
David Ungar
d61f6f2f66 Changes to support per-type-body fingerprints. 2020-01-27 15:14:46 -08:00
David Ungar
98b86c63d1 Use the initial value of EnableFineGrainedDependencies as the default. 2020-01-23 12:12:17 -08:00
David Ungar
cbd458c968 Make tests more deterministic by sorting jobs before scheduling 2020-01-16 13:20:35 -08:00
David Ungar
cc89dad526 Fine-grained and driver fixes.
Restructure fine-grained-dependencies to enable unit testing

Get frontend to emit correct swiftdeps file (fine-grained when needed) and only emit dot file for -emit-fine-grained-dependency-sourcefile-dot-files

Use deterministic order for more information outputs.

Set EnableFineGrainedDependencies consistently in frontend.

Tolerate errors that result in null getExtendedNominal()

Fix memory issue by removing node everywhere.

Break up print routine

Be more verbose so it will compile on Linux.

Sort batchable jobs, too.
2020-01-11 21:57:14 -08:00
Saleem Abdulrasool
b483047afe Revert "[Incremental] Dependency fixes in preparation for fine-grained dependencies" 2020-01-09 19:14:47 -08:00
David Ungar
6fffe724f2 Fine-grained and driver fixes.
Restructure fine-grained-dependencies to enable unit testing

Get frontend to emit correct swiftdeps file (fine-grained when needed) and only emit dot file for -emit-fine-grained-dependency-sourcefile-dot-files

Use deterministic order for more information outputs.

Set EnableFineGrainedDependencies consistently in frontend.

Tolerate errors that result in null getExtendedNominal()

Fix memory issue by removing node everywhere.

Break up print routine

Be more verbose so it will compile on Linux.

Sort batchable jobs, too.
2020-01-04 14:37:06 -08:00
David Ungar
2a79331ac3 add -enable/disable-only-one-dependency-file flag, on by default 2019-12-18 16:07:51 -08:00
David Ungar
73a46ce57e Revert "[Incremental, Driver] Only emit a real make-style dependency file for one frontend job." 2019-12-12 22:26:25 -08:00
David Ungar
2fc0f7899c Fix comment for OnlyOneDependencyFile 2019-12-11 15:49:12 -08:00
David Ungar
46687189a7 -only-one-dependency-file causes only the first frontend job to emit a real dependency file. 2019-12-10 22:52:57 -08:00
David Ungar
6a6e9357ef Change "experimental" to "fine-grained". 2019-12-04 08:50:44 -08:00
David Ungar
3d3507b7b6 Remove unparsed ranges and use diffs to schedule dependents earlier. 2019-12-03 17:23:02 -08:00
David Ungar
3cba2306ca Moving tests and driver refactoring. 2019-12-03 09:24:17 -08:00
David Ungar
08cfe80061 Don't crash when asking for comparison but not incremental 2019-11-23 11:21:33 -08:00
David Ungar
468a23cef9 report stages unfmt 2019-11-20 13:28:19 -08:00
David Ungar
ae64f471cd Reporting refactoring 2019-11-19 16:42:21 -08:00
David Ungar
bc403424ee Use sets 2019-11-19 13:10:33 -08:00
David Ungar
ee17f61179 factor out comparator and report supp jobs 2019-11-19 12:22:04 -08:00
David Ungar
d2146d1c47 Report falling back differently. 2019-11-18 23:09:58 -08:00
David Ungar
38a6559aa9 Take path arg for comparo 2019-11-18 20:23:10 -08:00
David Ungar
3433bf8cef comparision WIP 2019-11-16 21:39:19 -08:00
David Ungar
52feb1391b Correct uninitialized flag bug. 2019-11-12 20:41:03 -08:00
David Ungar
742c3985bd Source-range-based dependencies
Frontend outputs source-as-compiled, and source-ranges file with function body ranges and ranges that were unparsed in secondaries.
Driver computes diffs for each source file. If diffs are in function bodies, only recompiles that one file. Else if diffs are in what another file did not parse, then the other file need not be rebuilt.
2019-11-12 20:41:02 -08:00
David Ungar
b82694c307 Format 2019-01-30 17:19:56 -08:00
David Ungar
2f65ac3735 Cosmetic cleanups 2019-01-30 17:16:49 -08:00
David Ungar
3d8779efba Fix print bugs unfmt 2019-01-26 21:47:52 -08:00
David Ungar
9d84bc2af1 WIP tracer 2019-01-26 09:36:40 -08:00
David Ungar
323c42c532 Fomat 2019-01-24 18:46:49 -08:00
David Ungar
b520b242dc Collapsed lots of changes. 2019-01-24 18:46:49 -08:00
Adrian Prantl
ff63eaea6f Remove \brief commands from doxygen comments.
We've been running doxygen with the autobrief option for a couple of
years now. This makes the \brief markers into our comments
redundant. Since they are a visual distraction and we don't want to
encourage more \brief markers in new code either, this patch removes
them all.

Patch produced by

      for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done
2018-12-04 15:45:04 -08:00
David Ungar
1f4dfce598 Add -enable-experimental-dependencies and push it through. 2018-10-28 00:39:36 -07:00
Graydon Hoare
0f26b9c12d [Driver] <rdar://43955209> Remove obsolete/fragile batch mode 'repartitioning' code. 2018-10-09 13:31:41 -07:00
Jordan Rose
e224e31720 Break almost all dependencies of Driver on Frontend
- Sink OutputFileMap{.h,.cpp} and ReferenceDependencyKeys.h to Basic
- Remove unnecessary includes of Frontend.h.
2018-08-27 20:47:58 -07:00
Graydon Hoare
d5a9f44e4a [BatchMode] <rdar://41271283> Limit memory pressure on large modules. 2018-07-30 17:26:31 -07:00