Commit Graph

5899 Commits

Author SHA1 Message Date
Mike Ash
4ccfdfb72a [Runtime] Fix StableAddressConcurrentReadableHashMap threading crash.
StableAddressConcurrentReadableHashMap::getOrInsert had a race condition in the first lookup, where the snapshot was destroyed before the pointer was extracted from the returned wrapper. Fix this by creating the snapshot outside the if so that it stays alive.

rdar://problem/71932487
2020-12-21 16:52:56 -05:00
Pavel Yaskevich
e985d97e05 Merge pull request #35127 from xedin/rdar-38378503
[TypeChecker] Un-XFAIL perf test-case for rdar://23620262
2020-12-18 10:45:01 -08:00
David Zarzycki
238413d349 [testing] add missing REQUIRES: concurrency 2020-12-17 09:03:04 -05:00
Nate Chandler
d2726c31bb [Async CC] Don't lookup known archetype conformance.
Previously, when saving NecessaryBindings for an async function, if a
type that was passed-in happened to be an archetype, a lookup for that
type's conformance would always be done.  However, that lookup was not
always necessary or possible such as in the case where both the metadata
and the witness table were provided to the function in an async context.
Here, that is fixed by using the conformance that was seen when
constructing the NecessaryBindings if one is available.

rdar://problem/72397303
2020-12-16 17:20:31 -08:00
Pavel Yaskevich
0d040e2420 [TypeChecker] Un-XFAIL perf test-case for rdar://23620262 2020-12-16 12:04:15 -08:00
Pavel Yaskevich
c6bdeea852 [ConstraintSystem] Strengthen dependent member type checks while inferring bindings
Look through specifier (inout, l-value) and optional types while
checking for presence of dependent member types to avoid inferring
incorrect bindings (which could lead to infinite recursion in the
solver).

Resolves: SR-13856
Resolves: rdar://problem/71383770
2020-12-14 16:39:13 -08:00
Nate Cook
c35b567001 Temporary removal of RangeSet/DiscontiguousSlice (#35076) 2020-12-14 08:42:01 -06:00
Karoy Lorentey
8082b58365 Merge pull request #34961 from lorentey/buffers-need-to-be-fast-but-not-too-fast
[stdlib] Review and fix some problems with unsafe buffer and Range initialization
2020-12-12 19:13:20 -08:00
Zoe Carver
3dff6226e3 Merge pull request #28484 from zoecarver/optimize/mandatory-function-cleanup-pass
Remove dead function cleanup from mandatory inlining
2020-12-11 16:49:49 -08:00
zoecarver
6def04d360 Removes dead function cleanup from MandatoryInlining.
This will help reduce compile time in SourceKit (among others). Dead
function elimination will handle the removal of dead functions (not in
-Onone).
2020-12-10 09:18:16 -08:00
Arnold Schwaighofer
20dd3997de This test also fails in optimize size mode
rdar://71933996
2020-12-08 07:12:18 -08:00
Karoy Lorentey
c5c27c7c69 [stdlib] Add a missing debug precondition to [Closed]Range.init(uncheckedBounds:)
Unchecked APIs must still perform checks in debug builds to ensure that invariants aren’t violated.
(I.e., these aren’t a license to perform invalid operations — they just let us get rid of the checks when we know for sure they are unnecessary.)
2020-12-04 02:06:22 -08:00
Karoy Lorentey
7f63b42496 [test] ArrayTraps: Skip trap test on negative UBP counts in release builds 2020-12-04 02:06:21 -08:00
Arnold Schwaighofer
007c74f5ba Temporarily disable test in optimize mode
The test failed on oss-swift_tools-RA_stdlib-RD_test-simulator

rdar://71933996
2020-12-03 07:21:12 -08:00
Eric Miotto
8fc2598167 [build-script] Allow to tune dsymutil parallelism (#34795)
This should enable scaling when using machines with large amount of
RAM.

To better support machines with lower spec, process one binary per
dsymutil invocation (reverting #34149).

Add some (limited) facilities to gather the time taken to execute
dsymutil to better assist in tuning the parameter -- these are printed in
JSON format in the log to allow for easier scraping

```
{ "command": "dsymutil", "start": "2020-11-18T18:10:47" }
{ "command": "dsymutil", "end": "2020-11-18T18:14:45" }
```

Addresses rdar://71018443
2020-12-01 07:11:10 -08:00
David Zarzycki
0e650c1c89 [Testing] Add missing REQUIRES 2020-12-01 06:39:13 -05:00
eeckstein
d01aa21fdb Merge pull request #34867 from eeckstein/fix-escape-analysis
EscapeAnalysis: fix a quadratic behavior in ConnectionGraph::getNode
2020-12-01 10:02:35 +01:00
Nate Chandler
f33f1d3646 [Async CC] Always add full type metadata to bindings.
NecessaryBindings are used by both async functions and partial apply
forwarders.  The latter are able to avoid bindings in some cases because
a new function is generated where the information that would otherwise
be available in the bindings can be made available.  That is not the
case for async functions.  A generic async function requires all of the
metadata and witness tables be passed along to it: unlike a partial
apply forwarder it isn't in any way specialized so this information
can't be recovered.

Previously, metadata bindings were always passed along to async
functions.  However, destructuring that can be done for partial apply
forwarders was still being applied.  This resulted in an inappropriate
and unexpected number of bindings in NecessaryBindings.

Here, that destructuring is avoided for metadata passed to async
functions.

Now, the full metadata required by async functions are passed along to
them as necessary.

rdar://problem/71816041
2020-11-30 14:02:56 -08:00
Karoy Lorentey
b0eafeed9f Merge pull request #34665 from lorentey/runtime-error-message-format
[runtime] Adjust file/line information in fatal error messages to match compiler diagnostics
2020-11-30 11:46:49 -08:00
Erik Eckstein
f14916832f EscapeAnalysis: fix a quadratic behavior in ConnectionGraph::getNode
Fixes a compile time problem. The single linked list of merge targets in connection graph nodes can be very large.
Update the final merge target in the map, so that it has to be traversed only once for a given SILValue.

rdar://problem/71602804
2020-11-24 15:47:46 +01:00
Nate Cook
cae81eece0 Fix issues with discontiguous-slice assignment (#34708)
The mutating collection subscript for discontiguous slices assigns to the wrong group
of indices. This fixes the behavior and adds test coverage.

rdar://problem/70690643
2020-11-18 11:16:26 -06:00
Colton Schlosser
244442939d Merge pull request #34751 from cltnschlosser/cs_swiftDriverTestDifferences
Modify driver tests to support swift-driver json and path differences
2020-11-17 21:25:57 -06:00
nate-chandler
84f92a3f00 Merge pull request #34784 from nate-chandler/concurrency/irgen/rdar71491604
[Async CC] Find wtable in async context in thunk.
2020-11-17 14:56:49 -08:00
Slava Pestov
fe5be6368e Merge pull request #34772 from slavapestov/fix-lazy-getter-source-range
Sema: Fix source range of 'lazy' property getter
2020-11-17 17:23:22 -05:00
Slava Pestov
9a510b8ffa Merge pull request #34773 from slavapestov/fix-objc-attr-diagnostic
Sema: Still diagnose '@objc' even if Foundation was imported
2020-11-17 17:22:48 -05:00
Slava Pestov
96c9456ee8 Sema: Still diagnose '@objc' even if Foundation was imported
We checked for an import of a module named 'Foundation' before
checking if Objective-C interoperability was enabled, which
would lead to hilarious results.

Fixes <https://bugs.swift.org/browse/SR-13713> / <rdar://problem/70140319>.
2020-11-17 14:54:34 -05:00
Nate Chandler
e06d316fe7 [Async CC] Find wtable in async context in thunk.
Previously, when looking up a protocol method, the witness table was
always exepcted to be the final argument passed to the function.

That is true for sync protocol witnesses but not for async witnesses.
In the async case, the witness table is embedded in the async context.

Here, the witness table is dug out of the async context.

rdar://problem/71491604
2020-11-17 11:23:37 -08:00
Slava Pestov
756357b8a2 Sema: Fix source range of 'lazy' property getter
The source range of the getter's body was set incorrectly;
both the start and the end were the property's location.

Instead, let's use the source range of the initializer
expression, which fixes an assertion in name lookup.

Fixes <rdar://problem/70732736>.
2020-11-16 23:46:11 -05:00
Slava Pestov
5808d9beb9 Parse: Remove parse-time name lookup 2020-11-16 22:39:44 -05:00
David Zarzycki
b1448edfba [Testing] Add missing REQUIRES: concurrency 2020-11-16 05:54:44 -05:00
Colton Schlosser
85c7a9c467 Update validation-test/Driver/Dependencies/rdar25405605.swift 2020-11-15 16:56:40 -06:00
Colton Schlosser
59a3271b73 Add missing backslash. Lost it in the conversion to regex 2020-11-15 01:53:44 -06:00
Colton Schlosser
95c5ccc235 Modify driver tests to support swift-driver json and path differences 2020-11-14 22:59:27 -06:00
Nate Chandler
e27647244d [AsyncCC] Resolve metadata from class instances.
Metadata for an instance of a type is resolved by extracting it from an
instance of the class.  When doing method lookup for an instance method
of a resilient class, the lowered self value was being obtained from the
list of arguments directly by indexing.  That does not apply to async
functions where self is embedded within the async context.  Here, the
self parameter is extracted from the async context so that the metadata
can in turn be extracted from it.

rdar://problem/71260862
2020-11-14 15:15:12 -08:00
Nate Chandler
11723ccc55 [Async CC] Never map to native explosions.
Previously, when lowering the entry point of an async function, the
parameters were lowered to explosions that matched those of sync
functions, namely native explosions.  That is incorrect for async
functions where the structured values are within the async context.
Here, that error is fixed, by adding a new customization point to
NativeCCEntryPointArgumentEmission which behaves as before for sync
functions but which simply extracts an argument from the async context
for async functions.

rdar://problem/71260972
2020-11-13 19:45:03 -08:00
Pavel Yaskevich
dcc42bc0f3 Merge pull request #34673 from xedin/rdar-71167129
[AST] Preserve l-valueness of covariant result type after replacement
2020-11-11 10:52:37 -08:00
Pavel Yaskevich
5ef64c4584 [AST] Preserve l-valueness of covariant result type after replacement
It's possible that covariant result type is wrapped in l-value.
Just like currently preserved optionality, transformation should
maintain l-valueness of a result type as well.

Resolves: rdar://problem/71167129
2020-11-10 22:50:00 -08:00
Robert Widmann
2aac6d2af4 Merge pull request #34679 from CodaFi/quality-of-type
Fix Crashes When Resolving Clang Types For Unrepresentable UnsafePointers
2020-11-10 18:53:33 -08:00
Robert Widmann
591c70e364 Fix Crashes When Resolving Clang Types For Unrepresentable UnsafePointers
If the underlying pointer type was not representable in C, we would
attempt to form a pointer type with a null underlying type and crash.
2020-11-10 16:04:05 -08:00
Holly Borla
9a67f53902 Merge pull request #34660 from hborla/array-scale-test-threshold
[NFC] Add back a higher polynomial threshold for rdar18360240.swift.gyb
2020-11-10 16:57:16 -05:00
Karoy Lorentey
1a051719e3 [runtime] Adjust file/line information in fatal error messages to follow diagnostic conventions
In debug configurations, fatal error messages include file & line number information. This update presents this information in a format matching the diagnostic conventions used by the compiler, which can be a slight productivity boost.

Code compiled with optimizations enabled (which is most production code) does not output this information, so it isn’t affected by this change.

Original format:

    Fatal error: A suffusion of yellow: file calc.swift, line 5

New format:

    calc.swift:5: Fatal error: A suffusion of yellow

Resolves rdar://68484891
2020-11-10 13:23:21 -08:00
Holly Borla
3b192b7c78 [NFC] Add back a higher polynomial threshold for rdar18360240.swift.gyb 2020-11-10 14:18:29 -05:00
Robert Widmann
363b66a7ad Fully Qualify the Parent Type When Diagnosing Missing Member Types
Use the FullyQualified<Type> abstraction from the prior commit plus DescriptiveDeclKind to give a bit more information when issuing a missing member type diagnostic during type resolution.
2020-11-09 17:10:18 -08:00
Holly Borla
a647f0fb5b Merge pull request #34399 from hborla/optimize-linked-operator-solving
[Constraint System] Implement heuristics for linked operator expressions in the solver proper.
2020-11-08 13:22:40 -08:00
Pavel Yaskevich
80c4c90403 Merge pull request #34603 from xedin/rdar-70256351
[ResultBuilders] Account of a fact that re-write of a statement can fail
2020-11-06 14:07:29 -08:00
Pavel Yaskevich
1d3f3204ca [ResultBuilders] Account of a fact that re-write of a statement can fail
If one of the statements in the result builder body fails to
apply solution, let's fail entire rewrite attempt, otherwise
type-checker would end up with AST that has null pointers for
some child nodes.

Resolves: rdar://problem/70256351
2020-11-05 16:29:58 -08:00
Robert Widmann
20f0d962f4 Merge pull request #34569 from bnbarham/do-not-skip-didset-typechecking
[TypeChecker] Do not attempt to skip typechecking for didSet
2020-11-05 12:26:27 -08:00
Pavel Yaskevich
1f1400581f Merge pull request #34584 from xedin/rdar-70880670
[CSGen] Turn invalid decls into holes
2020-11-05 12:09:06 -08:00
Holly Borla
2507a3155d [Test] Add a slow type checker test case from source compatibility suite. 2020-11-05 10:31:34 -08:00
Ben Barham
ea365d5d18 [TypeChecker] Do not attempt to skip typechecking for didSet
15f8eb45ea (see PR#26632) introduced
refined didSet semantics where the `oldValue` parameter is skipped if it
isn't used. This would perform typechecking, but later try to set the
body to skipped and thus fire an assert.

For now, do not attempt to skip typechecking of didSet accessors. Still
skip outputting their SIL though.
2020-11-05 11:27:38 +10:00