Commit Graph

32761 Commits

Author SHA1 Message Date
ravikandhadai
f563212f03 Revert "[SIL Optimization] Add a mandatory pass for optimizing the new os log APIs based on string interpolation." 2019-05-14 15:11:05 -07:00
Andrew Trick
a9070cf6d4 Add AccessEnforcementOpts fast paths.
1. During identifyAccess, determine if there are either any
identical accesses or an accesses that aren't already marked
no_nested_storage. If there are neither, then skip the subsequent
data flow analysis.

2. In the new StorageSet, indicate whether identical storage was
seen elsewhere in the function. During dataflow, only add an access
to the out-of-scope access set if was marked as having identical
storage with another access.

3. During data flow, don't track in scope conflicts for
instructions already marked [no_nested_conflict].
2019-05-14 15:09:40 -07:00
Bob Wilson
003290c5c7 Merge pull request #24777 from bob-wilson/rdar50151131
[Test] Add runtime 9999-availability check for a new test in Swift 5.1
2019-05-14 15:06:48 -07:00
swift-ci
28bad2b4a4 Merge pull request #24738 from atrick/simplify-accessed-storage-proj 2019-05-14 14:18:59 -07:00
Ben Langmuir
e9384bb351 Merge pull request #24540 from benlangmuir/cc-nested-keypath
[code-completion] Handle nested keypath dynamic lookup correctly
2019-05-14 13:30:48 -07:00
Joe Groff
7beff300f6 Merge pull request #24771 from jckarter/opaque-underlying-closure-test
Add regression test that opaque underlying type checking does not look in closures
2019-05-15 04:22:48 +08:00
Andrew Trick
c1bda8f090 Replace AccessedStorage projection with an index.
Further simplify AccessedStorage. Shrink it to two words. Remove the
Projection abstraction and streamline the projection logic.
2019-05-14 12:44:46 -07:00
Bob Wilson
1d98709131 [Test] Add runtime 9999-availability check for a new test in Swift 5.1
The testEncodingMultipleNestedContainersWithTheSameTopLevelKey check is new
in Swift 5.1 and will not pass when running with a 5.0 stdlib.

rdar://problem/50151131
2019-05-14 12:27:27 -07:00
swift-ci
05808b93fb Merge pull request #24728 from atrick/simplify-accessed-storage-no-rea 2019-05-14 12:01:23 -07:00
Suyash Srijan
71fee96093 [Typechecker] Ban tuples with duplicate labels 2019-05-14 19:43:46 +01:00
Alexander Shaposhnikov
1525e9bfc5 [Windows] Add initial implementation for TaskQueue 2019-05-14 11:42:08 -07:00
ravikandhadai
a6ff7bd824 Merge pull request #24336 from ravikandhadai/oslog-optimization
[SIL Optimization] Add a mandatory pass for optimizing the new os log APIs based on string interpolation.
2019-05-14 11:18:32 -07:00
Andrew Trick
0d3c6144ed Remove RefElementAddr field from AccessedStorage.
- code simplification critical for comprehension
- substantially improves the overhead of AccessedStorage comparison
- as a side effect improves precision of analysis in some cases

AccessedStorage is meant to be an immutable value type that identifies
a storage location with minimal representation. It is used in many global
interprocedural data structures.

The RefElementAddress instruction that it was derived from does not
contribute to the uniqueness of the storage location. It doesn't
belong here. It was being used to create a ProjectionPath, which is an
extremely inneficient way to compare access paths.

Just delete all the code related to that extra field.
2019-05-14 10:45:54 -07:00
Andrew Trick
8cc013ed3f Fix LICM debug output typo. 2019-05-14 10:45:53 -07:00
Joe Groff
1d6aca4e93 Add regression test that opaque underlying type checking does not look in closures 2019-05-14 10:06:00 -07:00
Slava Pestov
2a87b68eb6 Merge pull request #24758 from slavapestov/dynamic-self-in-convenience-init
IRGen: Fix DynamicSelfType metadata recovery in @objc convenience inializers
2019-05-14 12:39:34 -04:00
Sho Ikeda
6eead16283 [gardening] Remove unnecessary breaks 2019-05-15 00:54:33 +09:00
Rintaro Ishizaki
0283e4dbcb Merge pull request #24718 from kitasuke/SR-10241_string_literal
SR-10241 Consolidate StringInterpolationExpr to StringLiteralExpr in Syntax
2019-05-14 08:25:32 -07:00
Saleem Abdulrasool
9cb2e6e3ff Merge pull request #24755 from compnerd/unparseable
test: make test paths more portable
2019-05-14 07:48:14 -07:00
Doug Gregor
54d3930ae8 [Runtime] Adjust to conforming type when instantiating witness table.
When we find a protocol conformance descriptor for a given type, make sure
we adjust to the conforming type of that descriptor (following the superclass
chain as needed) before instantiating the witness table.

Fixes rdar://problem/49741838.
2019-05-13 20:53:02 -07:00
Slava Pestov
36e46c054d IRGen: Fix DynamicSelfType metadata recovery in @objc convenience initializers
An @objc convenience initializer can replace 'self'. Since IRGen
has no way to tell what the new 'self' value is from looking at
SIL, it always refers back to the original 'self' argument when
recovering DynamicSelfType metadata. This could cause a crash
if the metadata was used after the 'self' value had been
replaced.

To fix the crash, always insert the metadata recovery into the
entry block, where the 'self' value should be valid (even if
uninitialized, the 'isa' pointer should be correct).

Fixes <rdar://problem/50594689>.
2019-05-13 23:11:11 -04:00
Jordan Rose
e43a9f5475 [ModuleInterface] Propagate availability for synthesized extensions (#24753)
Otherwise, we can synthesize an extension that's extending a type
that's unavailable on a particular platform, or that conforms to a
protocol that hasn't been introduced on the minimum deployment target.
2019-05-13 19:55:00 -07:00
Ravi Kandhadai
b7b46622aa [SIL Optimization] Add a mandatory optimization pass for optimizing
the new os log APIs based on string interpolation.
2019-05-13 19:40:39 -07:00
Saleem Abdulrasool
8277f8bd31 test: make test paths more portable
Windows uses `\` as the separator rather than `/`.  Adjust the tests for
this.
2019-05-13 18:07:28 -07:00
Slava Pestov
b9f42b31dc Merge pull request #24665 from slavapestov/fully-checked-trivial-accessors
Build type checked bodies for more synthesized declarations
2019-05-13 21:05:54 -04:00
Xi Ge
bf93fac186 Merge pull request #24586 from dmcyk/ProtocolUSR
[api-digester] Serialize protocol USRs in conformances
2019-05-13 15:35:48 -07:00
Rintaro Ishizaki
6dd4d06b71 Merge pull request #24732 from rintaro/sourcekit-test-pureswift-sysmodule
[SourceKit] Add InterfaceGen test case for pure Swift system module
2019-05-13 15:12:27 -07:00
Ben Langmuir
636d63e609 [code-completion] Handle nested keypath dynamic lookup correctly
If the root type of the KeyPath also has dynamic member lookup, we need
to look through it.

rdar://problem/50450037
2019-05-13 14:32:33 -07:00
Slava Pestov
0bab515f66 Sema: Build type checked bodies for trivial accessors
This includes all synthesized accessors except for lazy getters
and observer setters.

Building checked AST has certain advantages:

- It is faster, avoiding the need to create and solve ConstraintSystems
  or performing various diagnostic and semantic walks over the AST.

- It allows us to postpone delayed body synthesis until needed in SILGen,
  instead of having to walk a list of "external declarations" in Sema.

It also unblocks lazier conformance checking. Now that SILGen can
trigger conformance checking on its own, we need to be able to
synthesize bodies of accessors that witness protocol requirements.
This will allow us to eventually remove Sema's "used conformances"
list.

Note that for now, various utility functions in CodeSynthesis.cpp are
used for both checked and unchecked function bodies, so they take a
'typeChecked' boolean parameter that complicates some logic more than
necessary. Once the remaining body synthesizers are refactored to
build type-checked AST, the 'typeChecked' flag will go away.
2019-05-13 17:25:49 -04:00
Slava Pestov
d22b3a7b0b Sema: Move the Optional-typed nil peephole to SILGen
When applying a solution to a nil literal of Optional type, we would
build a direct reference to Optional<T>.none instead of leaving the
NilLiteralExpr in place, because this would generate more efficient
SIL that avoided the call to the Optional(nilLiteral: ()) witness.

However, a few places in the type checker build type-checked AST, and
they build NilLiteralExpr directly. Moving the peephole to SILGen's
lowering of NilLiteralExpr allows us to simplify generated SIL even
further by eliding an unnecessary metatype value. Furthermore, it
allows SILGen to accept NilLiteralExprs that do not have a
ConcreteDeclRef set, which makes type-checked AST easier to build.
2019-05-13 17:25:49 -04:00
Daniel Rodríguez Troitiño
77a411add0 Merge pull request #24544 from drodriguez/android-aarch64-conditional-compilation
[android] Add a test for Android conditional compilation (AArch64)
2019-05-13 14:17:46 -07:00
Harlan Haskins
5cb98bfe80 [ModuleInterface] Pass -Rmodule-interface-rebuild to sub-invocation (#24737)
Previously, we wouldn't pass this flag to sub-invocations, which means
that if we had to fall back and recompile a transitive import, we
wouldn't get a remark.

rdar://50729662
2019-05-13 12:56:18 -07:00
eeckstein
cfc2dda69a Merge pull request #24705 from eeckstein/fix-vtable-serialization
Serialization: use the mangled class name for serializing vtables.
2019-05-13 12:47:03 -07:00
Rintaro Ishizaki
663defab4a [SourceKit] Add InterfaceGen test case for pure Swift system module
rdar://problem/50458412
(Reapply - Forgot to add `-target` in SourceKit test in previous change.)
2019-05-13 10:55:23 -07:00
Rintaro Ishizaki
b903f7191d Merge pull request #24727 from rintaro/ide-completion-init-dependenttypeclosure-rdar49480808
[CodeCompletion] Allow ErrorType in constructor
2019-05-13 10:06:37 -07:00
Mike Ash
0a3b722bf9 Merge pull request #24688 from mikeash/swift-nativensxxxcoding-test-availability
[Test] Guard SwiftNativeNSXXXCoding tests behind #available(9999).
2019-05-13 12:06:18 -04:00
Ted Kremenek
4beb673b8e Bump compiler version to Swift 5.1 (#24671)
* Bump version to Swift 5.1

* Update tests with compiler version bump

* Undo flatMap and math obsolescences
2019-05-13 07:32:39 -07:00
Rintaro Ishizaki
7b7c320bd5 [CodeCompletion] Allow ErrorType in constructor
Even if the constructor has `ErrorType` we can suggest it as long as it's
`FunctionType`.

rdar://problem/49480808
2019-05-13 01:32:57 -07:00
Daniel Rodríguez Troitiño
2587df2333 Merge pull request #24696 from drodriguez/android-fix-cursor-swiftonly-systemmodule
[test] Modify lit replacements for Android ARMv7
2019-05-12 11:31:38 -07:00
swift-ci
616ec93fa2 Merge pull request #24625 from atrick/canonicalize-stores 2019-05-11 19:32:29 -07:00
kitasuke
9155ed88e0 Use StringLiteralExpr for invalid InterpolatedStringLiteralExpr 2019-05-12 11:23:16 +09:00
kitasuke
b583fef8e2 Consolidate StringInterpolationExpr to StringLiteralExpr 2019-05-12 11:23:00 +09:00
Michael Gottesman
da37a56896 [sil] Change the immutable address use verifier to ignore br/cond_br uses that introduce address phis and re-enable the test that shows this behavior.
We want to eventually remove address phi arguments from SIL. This will enable
all sorts of nice IRGen optimizations and in general make life better. We are
not there yet, but given that is the direction we are going in, I don't think
there is much use in having to implement this sort of checking for SIL phi
arguments.

rdar://50676315
2019-05-11 14:37:11 -07:00
Erik Eckstein
c957c50e28 Serialization: use the mangled class name for serializing vtables.
To distinguish between classes which have the same name (but are in different contexts).
Fixes a miscompile if classes with the same name are used from a different module.

SR-10634
rdar://problem/50538534
2019-05-11 08:30:15 -07:00
Slava Pestov
174323516a Merge pull request #24704 from slavapestov/always-emit-class-stubs
Always emit class stubs
2019-05-10 22:56:24 -04:00
Rintaro Ishizaki
4cb7d27eba Revert "[SourceKit] Add InterfaceGen test case for pure Swift system module" 2019-05-10 18:35:34 -07:00
Slava Pestov
12469f5a9b IRGen: Always emit class stubs for classes with resilient ancestry
This logic is no longer guarded by a flag. Sema will still emit certain
diagnostics if the flag is not specified though.

Progress on <rdar://problem/49090631>.
2019-05-10 21:26:10 -04:00
Slava Pestov
97be86bbca Runtime: Don't try to register class stubs on older objc runtimes
This will allow us to emit class stubs unconditionally, rather than
checking the -enable-resilient-objc-class-stubs flag.

Part of <rdar://problem/49090631>.
2019-05-10 21:26:09 -04:00
Brent Royal-Gordon
08bd6bd715 Disable Prototypes/TextFormatting everywhere 2019-05-10 16:58:58 -07:00
Slava Pestov
d0c7eb67ba Merge pull request #24694 from slavapestov/random-ast-cleanups
More preliminary cleanups for 'Used Conformances' removal
2019-05-10 18:27:06 -04:00