Commit Graph

767 Commits

Author SHA1 Message Date
David Ungar
520b801bf0 Merge pull request #21177 from davidungar/A-exp-dep-graph-12-10-18
First cut at graph-based fine-grained experimental dependencies.
2019-02-03 21:15:17 -08:00
David Ungar
2f65ac3735 Cosmetic cleanups 2019-01-30 17:16:49 -08:00
David Ungar
b520b242dc Collapsed lots of changes. 2019-01-24 18:46:49 -08:00
Doug Gregor
0c88b88322 [ABI] Optionally emit mangled names into anonymous context metadata.
When -enable-anonymous-context-mangled-names is provided, emit mangled
names as part of the metadata of an anonymous context. This will allow
us to match textual mangled names to the metadata.

This is a backward-compatible ABI extension. Part of rdar://problem/38231646/.
2019-01-22 09:48:47 -08:00
Ankit Aggarwal
45290837b4 Merge pull request #21110 from aciidb0mb3r/swiftpm-manifest-version
Extend @available to support PackageDescription
2019-01-07 12:20:23 -08:00
Michael Gottesman
9dc8bbb866 [ownership] Eliminate -assume-parsing-unqualified-ownership-sil now that it is a no-op. 2018-12-19 12:54:13 -08:00
Xi Ge
4164600bed migrator: set up placeholder migration scripts for swift 4.2 2018-12-18 11:49:14 -08:00
Jordan Rose
00ed3e1185 [Driver] Don't suggest using the "major version" for -swift-version (#20563)
This was a nice feature when people said "-swift-version 3.1"...
up until we got "-swift-version 4.2" as an actual valid version.
Just drop the special case.

https://bugs.swift.org/browse/SR-8850
2018-12-10 08:41:21 -08:00
Ankit Aggarwal
92d09f4e19 Extend @available to support PackageDescription
<rdar://problem/46548531> Extend @available to support PackageDescription

This introduces a new private availability kind "_PackageDescription" to
allow availability testing by an arbitary version that can be passed
using a new command-line flag "-swiftpm-manifest-version". The semantics
are exactly same as Swift version specific availability. In longer term,
it maybe possible to remove this enhancement once there is
a language-level availability support for 3rd party libraries.

Motivation:

Swift packages are configured using a Package.swift manifest file. The
manifest file uses a library called PackageDescription, which contains
various settings that can be configured for a package. The new additions
in the PackageDescription APIs are gated behind a "tools version" that
every manifest must declare. This means, packages don't automatically
get access to the new APIs. They need to update their declared tools
version in order to use the new API. This is basically similar to the
minimum deployment target version we have for our OSes.

This gating is important for allowing packages to maintain backwards
compatibility. SwiftPM currently checks for API usages at runtime in
order to implement this gating. This works reasonably well but can lead
to a poor experience with features like code-completion and module
interface generation in IDEs and editors (that use sourcekit-lsp) as
SwiftPM has no control over these features.
2018-12-08 09:38:40 +05:30
Slava Pestov
aa747dcd81 Remove property behaviors 2018-12-07 20:38:33 -05:00
Harlan Haskins
2e50a431b1 Merge pull request #20986 from harlanhaskins/clogged-pipes
[SILOptimizer] Stop optimization after serialization if only emitting a module
2018-12-06 15:49:11 -08:00
Harlan Haskins
b137928ff5 [SILOptimizer] Add flag to stop optimization after serialization 2018-12-04 16:44:01 -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
Slava Pestov
b570a5de87 Remove -enable-key-path-resilience staging flag 2018-11-16 23:18:37 -05:00
Saleem Abdulrasool
da724b34ed Merge pull request #20574 from compnerd/lazy-metadata
IRGen: force lazy metadata initialization for PE/COFF
2018-11-15 16:22:18 -08:00
Saleem Abdulrasool
13d56a4f56 IRGen: force lazy metadata initialization for PE/COFF
The metadata reference to the pre-exsting VWT cannot be supported on PE/COFF
due to the direct reference to a value in an external module that is in
static data (the model requires indirecting through memory).  Always
force the lazy initialization for the metadata on such platforms.

This requires a secondary change - to initialize the VWT as well.  This
is ideally moved into the runtime where we can do this uniformly.
2018-11-15 11:05:47 -08:00
Arnold Schwaighofer
c3230dfc5c Add the implicit dynamic attribute in the IsDynamicRequest query 2018-11-14 12:04:17 -08:00
Michael Gottesman
e2d7f77557 [semantic-sil] Enable the mandatory sil ownership optimization on all stdlib overlays.
We can do this b/c all overlays pass the ownership verifier, so it is safe.
2018-11-13 16:08:14 -08:00
Harlan Haskins
e4db036d7f Merge pull request #20203 from harlanhaskins/operator-oh-would-you-help-me-place-this-call
[Frontend] Remove -enable-operator-designated-types
2018-11-12 15:35:50 -08:00
Harlan Haskins
44f1806779 Turn on -enable-operator-designated-types for the standard library
Because this feature mostly exists for the standard library, turn it on
specifically. This avoids having to serialize it in the flags necessary
for parseable interfaces.
2018-11-09 15:26:21 -08:00
Arnold Schwaighofer
fb7b223ba2 Add support to modify chaining behavior of dynamic replacements
Default to not chain dynamic replacements: Only one replacement and the
original implementation are active.
2018-11-09 13:17:09 -08:00
Andrew Trick
d62a018584 Merge pull request #20442 from atrick/Ounchecked-exclusivity
Disable runtime exclusivity checks with -Ounchecked.
2018-11-08 21:53:30 -08:00
Andrew Trick
f836e76857 Disable runtime exclusivity checks with -Ounchecked.
If runtime asserts are disabled in general, also disable runtime
exclusivity checks unless explicitly requested.

-Ounchecked is an unsupported benchmarking mode, but, if used, it
should disable all runtime assertions. Exclusivity checks are no more
essential than integer overflow or bounds checks.
2018-11-08 15:43:56 -08:00
Marc Rasi
bf18697b4f parsing, typechecking, and SILGen for #assert
`#assert` is a new static assertion statement that will let us write
tests for the new constant evaluation infrastructure that we are working
on. `#assert` works by lowering to a `Builtin.poundAssert` SIL
instruction. The constant evaluation infrastructure will look for these
SIL instructions, const-evaluate their conditions, and emit errors if
the conditions are non-constant or false.

This commit implements parsing, typechecking and SILGen for `#assert`.
2018-11-07 16:34:17 -08:00
Arnold Schwaighofer
44b3a47e56 Merge pull request #20333 from aschwaighofer/dynamic_function_replacement
Dynamic function replacement
2018-11-07 13:08:46 -08:00
Arnold Schwaighofer
c158106329 Allow dynamic without @objc in -swift-version 5
Dynamic functions will allow replacement of their implementation at
runtime.
2018-11-06 09:53:21 -08:00
Andrew Trick
a17dbc7c74 Enable run-time exclusivity checking in release mode.
This change could impact Swift programs that previously appeared
well-behaved, but weren't fully tested in debug mode. Now, when running
in release mode, they may trap with the message "error: overlapping
accesses...".

Recent optimizations have brought performance where I think it needs
to be for adoption. More optimizations are planned, and some
benchmarks should be further improved, but at this point we're ready
to begin receiving bug reports. That will help prioritize the
remaining work for Swift 5.

Of the 656 public microbenchmarks in the Swift repository, there are
still several regressions larger than 10%:

TEST                    OLD      NEW      DELTA      RATIO
ClassArrayGetter2       139      1307     +840.3%    **0.11x**
HashTest                631      1233     +95.4%     **0.51x**
NopDeinit               21269    32389    +52.3%     **0.66x**
Hanoi                   1478     2166     +46.5%     **0.68x**
Calculator              127      158      +24.4%     **0.80x**
Dictionary3OfObjects    391      455      +16.4%     **0.86x**
CSVParsingAltIndices2   526      604      +14.8%     **0.87x**
Prims                   549      626      +14.0%     **0.88x**
CSVParsingAlt2          1252     1411     +12.7%     **0.89x**
Dictionary4OfObjects    206      232      +12.6%     **0.89x**
ArrayInClass            46       51       +10.9%     **0.90x**

The common pattern in these benchmarks is to define an array of data
as a class property and to repeatedly access that array through the
class reference. Each of those class property accesses now incurs a
runtime call. Naturally, introducing a runtime call in a loop that
otherwise does almost no work incurs substantial overhead. This is
similar to the issue caused by automatic reference counting. In some
cases, more sophistacated optimization will be able to determine the
same object is repeatedly accessed. Furthermore, the overhead of the
runtime call itself can be improved. But regardless of how well we
optimize, there will always a class of microbenchmarks in which the
runtime check has a noticeable impact.

As a general guideline, avoid performing class property access within
the most performance critical loops, particularly on different objects
in each loop iteration. If that isn't possible, it may help if the
visibility of those class properties is private or internal.
2018-11-02 16:54:31 -07:00
Harlan Haskins
9f44e2cf4c [ParseableInterface] Add module arguments if using supplemental output maps
Currently, the check for whether to serialize parseable interface
arguments doesn't handle the case where a supplementary output file map
is used, preferring only to check if the frontend is passed
`-emit*interface`. Instead, check if the frontend inputs and outputs
contains a parseable interface, and use that to determine if we need to
save args.

This also puts `-module-link-name` in the parseable interface arg list.
2018-10-30 18:17:14 -07:00
Slava Pestov
38ccddd24f Remove Swift 3 @objc behavior 2018-10-30 16:46:08 -04:00
David Ungar
1f4dfce598 Add -enable-experimental-dependencies and push it through. 2018-10-28 00:39:36 -07:00
Graydon Hoare
5c05bb02cc [ModuleInterface] Save .swiftinterface args when either option synonym is present. 2018-10-11 23:56:21 -07:00
Graydon Hoare
1cce09627d [ModuleInterface] Escape arguments written to .swiftinterface comment. 2018-10-11 23:56:20 -07:00
Graydon Hoare
b71c55ab8b [ModuleInterface] Address misc review comments. 2018-10-11 23:56:20 -07:00
Graydon Hoare
5e202697a3 [ModuleInterface] Mop up remaining "textual interface" terminology. 2018-10-11 23:56:19 -07:00
Graydon Hoare
49feb51fff [ModuleInterface] Add llvm::Triple overload of setTargetTriple. 2018-10-11 16:43:52 -07:00
Graydon Hoare
879ed583bf [ModuleInterface] Save TextualInterfaceOption invocation Args to TextualInterfaceFlags. 2018-10-11 16:43:49 -07:00
Xi Ge
63bfbb5ec6 migrator: remove migration scripts for migrating from Swift 3. 2018-10-10 11:48:02 -07:00
Mark Lacey
36284ba377 Extend operator decls to allow any designated nominal type for lookup.
Rather than limiting this to protocols, allow any nominal type.

Rename -enable-operator-designated-protocols to
-enable-operator-designated-types to reflect the change.
2018-10-06 17:02:31 -07:00
Slava Pestov
87ec607233 IRGen: Add a new 'Legacy' lowering mode that loads type info from a YAML file
The YAML format is the same one produced by the -dump-type-info
frontend mode.

For now this is only enabled if the -read-type-info-path frontend
flag is specified.

Progress on <rdar://problem/17528739>.
2018-10-04 23:33:17 -04:00
Mark Lacey
a688464218 [ConstraintSystem] Add a staging option for the operator protocols work.
Add a staging option for enabling upcoming changes in the solver in
support of using the protocols designated in Policy.swift to guide
operator type checking.
2018-10-03 11:48:43 -07:00
Raj Barik
89d31be7a5 ExistentialSpecializer Pass (without SILCombine/ConcreteType Propagation) 2018-09-25 14:52:00 -07:00
Graydon Hoare
5a563f59af [Stats] Add SWIFTC_MAXIMUM_DETERMINISM to inhibit parallelism everywhere. 2018-09-13 16:15:49 -07:00
Mark Lacey
1e7dae3741 Merge pull request #19145 from rudkx/parse-designated-protocol
Add support for parsing designated protocols in operator declarations.
2018-09-06 22:01:02 -07:00
Mark Lacey
ae84ac81d4 Add a frontend option to enable parsing "operator protocol designators". 2018-09-04 23:10:30 -07:00
Doug Gregor
e670ac42d9 Add command-line option -warn-implicit-overrides.
When provided, this flag warns about implicit overrides, where a
declaration overrides another declaration but is not marked with the
‘override’ keyword. The warning can be suppressed by either providing
‘override’ or ‘@_nonoverride’.

At present, this only happens with overrides in protocols.
2018-09-04 16:42:06 -07:00
swift-ci
6e16e29aa1 Merge pull request #19024 from adrian-prantl/40241256 2018-08-29 17:28:43 -07:00
Xi Ge
ce29c64964 [Evaluator] Refactor evaluator's GraphViz output to the destructor of the evaluator. NFC
This allows us to output dependency-graph while using the compiler in
other tools, like swift-ide-test, sourcekitd-test, etc.
2018-08-28 18:16:44 -07:00
Adrian Prantl
97cbd3b1cf Deserialize Swift compatibility version in CompilerInvocation::loadFromSerializedAST()
LLDB needs the -swift-version because the -D__swift__ macro affects
how Clang modules are built. This currently has the really odd effect
that when debugging a Swift program that is not using the very latest
Swift version, the first "po" takes several seconds, because the
module cache needs to be rebuilt.

rdar://problem/40241256
2018-08-28 13:04:27 -07:00
Robert Widmann
014fd952ef [NFC] Silence a bunch of Wunused-variable diagnostics 2018-08-24 15:16:40 -07:00
Harlan Haskins
14a7ae56db [TBDGen] Remove TBD options from FrontendOptions
This patch removes the duplication between FrontendOptions and
TBDGenOptions by parsing the TBDGenOptions up front similarly to IRGen
and SIL options.
2018-08-15 14:53:44 -07:00