Commit Graph

1953 Commits

Author SHA1 Message Date
Jordan Rose
f56af4e0af [ParseableInterface] Don't print conformances for non-public types (#20656)
I have nothing to say but "oops".
2018-11-26 11:29:36 -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
619673e1fa Merge pull request #20570 from aschwaighofer/synthesize_accessors_dynamic_globals
Synthesize accessors for dynamic global variables
2018-11-14 14:35:47 -08:00
Arnold Schwaighofer
c3230dfc5c Add the implicit dynamic attribute in the IsDynamicRequest query 2018-11-14 12:04:17 -08:00
Jordan Rose
25c6c16064 Add frontend option -no-serialize-debugging-options (#20555)
By default, the frontend tries to figure out if the built module is
likely to be distributed in some way, and uses that to decide whether
to include options that help with debugging (such as local search
paths). There's long been a -serialize-debugging-options that forces
those options to be included even when it looks like a framework is
being built, but the opposite has been absent until now.

Note that both of these options are still /frontend/ options, not
driver options, which means they could still change in the future.
(I'd really like to get to a point where debugging doesn't need to
sniff these options out from the module this way, but there are some
complications we'd need to work out. Swift 1 expediency coming back to
cause trouble again.)

rdar://problem/37954803
2018-11-14 10:10:01 -08:00
Graydon Hoare
f212d185c5 Merge pull request #20458 from graydon/text-interface-format-version
Text interface format version
2018-11-14 09:19:27 -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
Graydon Hoare
657543119c [ModuleInterface] Version string (semi)finalization, format version checking. 2018-11-13 13:25:15 -08:00
Graydon Hoare
c6ac3867cd [ModuleInterface] Address review comments. 2018-11-13 13:25:15 -08:00
Graydon Hoare
8959923ac8 [ModuleInterface] Propagate dependencies to outer DependencyTracker for use in .d files. 2018-11-13 13:25:15 -08:00
Graydon Hoare
d44943a482 [ModuleInterface] Include and dedupe (transitive) FILE_DEPENDENCY records from dependencies. 2018-11-13 13:25:15 -08:00
Graydon Hoare
b07425ac1d [ModuleInterface] Switch from mtime to xxhash in FILE_DEPENDENCY records. 2018-11-13 13:25:15 -08:00
Graydon Hoare
8b0b5ad475 [ModuleInterface] Suppress warnings in sub-invocation. 2018-11-13 13:24:23 -08:00
Graydon Hoare
be7fcfdc2d [ModuleInterface] Emit error when we fail to find a dependency. 2018-11-13 13:24:23 -08:00
Graydon Hoare
3aab6fd5f3 [ModuleInterface] Use ForwardingDiagnosticConsumer in sub-instance. 2018-11-13 13:24:23 -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
Jordan Rose
ff7d03fbd1 [ParseableInterfaces] Handle unsatisfiable conditional conformances (#20433)
...by printing them with a dummy, unsatisfiable condition. This
happens when a public type conforms to a public protocol with
non-public conditions; the conformance can't be used in inlinable
code, but neither is it okay for a client to declare their own
conformance (constrained or unconstrained).

rdar://problem/45657450
2018-11-09 08:28:49 -08:00
Arnold Schwaighofer
c83f63855b Merge pull request #20428 from aschwaighofer/private_imports
Add @_private(from: "SourceFile.swift") imports
2018-11-09 07:18:25 -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
swift-ci
4fb4cb058d Merge pull request #19618 from apple/marcrasi-static-assert 2018-11-08 21:33:35 -08:00
Arnold Schwaighofer
9feb75806a Refactor 2018-11-08 17:50:25 -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
Jordan Rose
4d041a360a [ParseableInterface] Print protocols inherited through private protos (#20169)
In this code:

    private protocol MyProto: Hashable {}
    public struct MyStruct: MyProto {}

Being Hashable is part of MyStruct's public API, even though it's not
written explicitly. If we're not going to require people to write it
explicitly, we need to make sure it gets printed.

rdar://problem/44662501
2018-11-08 10:33:42 -08:00
Arnold Schwaighofer
963c64e3e7 Add @_private(from: "SourceFile.swift") imports
A module compiled with `-enable-private-imports` allows other modules to
import private declarations if the importing source file uses an
``@_private(from: "SourceFile.swift") import statement.

rdar://29318654
2018-11-08 08:00:47 -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
Andrew Trick
945ee929ad Merge pull request #20302 from atrick/enforce-exclusivity
Enable run-time exclusivity checking in release mode.
2018-11-07 08:47:01 -08:00
Michael Gottesman
a761d7c0ba Revert "Revert "Revert "[Build System: CMake] make add_swift_library a wrapper to add_llvm_library"""
This reverts commit 121f5b64be.

Sorry to revert this again. This commit makes some pretty big changes. After
messing with the merge-conflict created by this internally, I did not feel
comfortable landing this now. I talked with Saleem and he agreed with me that
this was the right thing to do.
2018-11-06 13:24:00 -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
Graydon Hoare
e272ece309 Merge pull request #20170 from graydon/text-interface-to-module
Switch from .sid files to using FILE_DEPENDENCY records in INPUT_BLOCK
2018-11-06 07:52:09 -08:00
Saleem Abdulrasool
121f5b64be Revert "Revert "[Build System: CMake] make add_swift_library a wrapper to add_llvm_library""
This reverts commit 103f9a8246.
2018-11-05 14:37:40 -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
Xi Ge
103f9a8246 Revert "[Build System: CMake] make add_swift_library a wrapper to add_llvm_library" 2018-11-02 12:49:07 -07:00
Saleem Abdulrasool
42772922e0 Merge pull request #19514 from compnerd/breakup
[Build System: CMake] make add_swift_library a wrapper to add_llvm_library
2018-11-02 09:56:17 -07:00
Graydon Hoare
0a3bd3eae9 [ModuleInterface] Address more review comments. 2018-11-01 21:17:09 -07:00
Graydon Hoare
fc4510e2b8 [ModuleInterface] Make up-to-date check recursive, since it runs first. 2018-11-01 10:51:44 -07:00
Graydon Hoare
9b258192de [ModuleInterface] Add more debug logging. 2018-11-01 10:51:44 -07:00
Graydon Hoare
6cb7b46f39 [ModuleInterface] Set EnableParseableModuleInterface in sub-instance. 2018-11-01 10:51:44 -07:00
Graydon Hoare
8d6f6e2d2f [ModuleInterface] Pass clang module cache path to sub-instance. 2018-11-01 10:51:44 -07:00
Graydon Hoare
11f3c9470d [ModuleInterface] Add PrintingDiagnosticConsumer to sub-instance. 2018-11-01 10:51:44 -07:00
Graydon Hoare
1a4ba3851b [ModuleInterface] Factor out clang module cache path extraction function. 2018-11-01 10:51:44 -07:00
Graydon Hoare
fd226ae761 [ModuleInterface] Address review comments. 2018-11-01 10:51:44 -07:00
Graydon Hoare
4938b002b4 [ModuleInterface] Remove SwiftParseableInterfaceDeps files, use INPUT_BLOCK. 2018-11-01 10:51:16 -07:00
Saleem Abdulrasool
39dde93c88 add_swift_host_library: rename LINK_LIBRARIES to LINK_LIBS 2018-10-31 12:46: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