Skip to content

Merge main 2022-03-24 #4388

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 123 commits into from
Mar 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
123 commits
Select commit Hold shift + click to select a range
8a7e955
Move -enable-sil-opaque-value to SILOptions.
atrick Jan 18, 2022
8457ba3
Add emitLoad/emitStore to OpaqueValue type lowering.
atrick Jan 18, 2022
2907c61
SILModule::hasLoweredAddress
atrick Feb 15, 2022
b90007a
Update and reimplement AddressLowering pass (for SIL opaque values).
atrick Nov 29, 2021
b187ba0
Add support for indirect tuple-type results.
atrick Mar 1, 2022
f4176b9
[SIL-opaque] Code review suggestions
atrick Mar 8, 2022
c4e167f
Fix alloc_stack placement for open_existential.
atrick Mar 9, 2022
71175f7
Rename "phi copy" to "phi move" for consistency with documentation.
atrick Mar 9, 2022
d50c8f6
[SIL-opaque] avoid handling operands past 64k
atrick Mar 9, 2022
fd45bd0
[SIL-opaque] More file-level documentation
atrick Mar 9, 2022
355ca16
[SIL-opaque] Add section-level comment explaining storage allocation
atrick Mar 9, 2022
ef2bf97
[SIL-opaque] remove cleanupAfterCall helper
atrick Mar 9, 2022
f79c6c8
[SIL-opaque] add a test case for phi coalescing
atrick Mar 10, 2022
e116998
[SIL-opaque] in-depth top-level documentation for phi coalescing.
atrick Mar 10, 2022
7f88908
[SIL-opaque] minor NFC review feedback
atrick Mar 10, 2022
72817df
[SIL-opaque] rename materialization functions.
atrick Mar 10, 2022
6f3a0c3
[SIL-opaque] rename initializeComposingUse
atrick Mar 10, 2022
dbaada4
Stay in vectors longer before doing a horizontal sum
Catfish-Man Mar 18, 2022
0250794
[utils] Remove Python 2
dduan Mar 18, 2022
51777d5
[CodeCompletion] Move TypeCheckCompletionCallbacks to IDE
ahoppen Mar 18, 2022
17eb6ea
[CodeCompletion] Unify logic to retrieve completion expr type for all…
ahoppen Mar 18, 2022
03d819f
[CodeCompletion] Check whether surrounding context supports async in …
ahoppen Mar 19, 2022
cb51464
[test] Add some additional regex parsing tests
hamishknight Mar 21, 2022
9ab7a82
Cleaning up _runAsyncMain a bit
etcwilde Dec 21, 2021
4700bc7
Add _runAsyncMain to api digester list
etcwilde Mar 21, 2022
a1e3afa
[Option] Add feature flag for empty ABI descriptors
bnbarham Mar 21, 2022
dc82433
RequirementMachine: Another silly GenericSignatureBuilder compatibili…
slavapestov Mar 21, 2022
7bcd13b
[cxx-interop] Avoid crashing when importing functions that take point…
egorzhdan Mar 18, 2022
9081611
Renable StringMemoryTest
Azoy Mar 21, 2022
a467958
Integrate newer swift-experimental-string-processing (50ec05d).
rxwei Mar 18, 2022
056132c
[move-function] Add a new pass that propagates debug_value [moved] in…
gottesmm Feb 1, 2022
e1c4e10
[move-function] Update the behavior for debug intrinsics on values in…
gottesmm Feb 25, 2022
9da5a4b
[move-function-addr] Fix a subtle bug where we were not inserting deb…
gottesmm Mar 3, 2022
7091c87
[move-function] Update a test now that I have merged in the better de…
gottesmm Mar 13, 2022
50a0b91
[move-function] Propagate debug_value undef rather than treat it as a…
gottesmm Mar 13, 2022
b6c2b3e
[Diagnostics] Fix out-of-bounds index while fixing argument mismatch
xedin Mar 21, 2022
81fc0ae
Frontend: By default, assume `-target-min-inlining-version min` for m…
tshortli Mar 18, 2022
1717935
Add diagnostic verifier features to Diagnostics.md
beccadax Mar 21, 2022
132620a
Correct description of fix-it line numbers
beccadax Mar 21, 2022
3597652
[CodeCompletion] Make sawSolution non-final and override sawSolutionI…
ahoppen Mar 21, 2022
5afa1b1
Merge pull request #41934 from bnbarham/add-empty-abi-feature
bnbarham Mar 21, 2022
90b279b
Merge pull request #41933 from etcwilde/ewilde/concurrency-reland-run…
etcwilde Mar 21, 2022
9b9888c
Merge pull request #41937 from Azoy/something-here
Azoy Mar 22, 2022
687beac
Merge pull request #41894 from apple/egorzhdan/cxx-decltype-crash
zoecarver Mar 22, 2022
ac7efc1
Merge pull request #41935 from slavapestov/rqm-concrete-contraction-u…
slavapestov Mar 22, 2022
2c5f019
Merge pull request #41927 from rxwei/string-processing-integration-50…
rxwei Mar 22, 2022
406aa86
Merge pull request #41557 from atrick/addrlower-update
atrick Mar 22, 2022
2697e96
Merge pull request #41885 from ahoppen/pr/refactor-solver-completion
ahoppen Mar 22, 2022
045302b
[CodeCompletion] Filter overloads if their function application doesn…
ahoppen Mar 21, 2022
1ef2c59
Merge pull request #41917 from ahoppen/pr/filter-overloads-if-no-cc-t…
ahoppen Mar 22, 2022
e5e60a5
Merge pull request #41930 from hamishknight/quoted-in-context
hamishknight Mar 22, 2022
1e2b94e
Merge pull request #41944 from gottesmm/add_initial_dominance_impl
gottesmm Mar 22, 2022
1c07c50
Fix a minor (1 per process) leak in AccessEnforcementSelection
atrick Mar 22, 2022
b373bd6
Sema: Don't verify protocol requirement signatures if there was an error
slavapestov Mar 22, 2022
4069434
RequirementMachine: Preserve sugar when splitting concrete equivalenc…
slavapestov Mar 21, 2022
9ccdd15
RequirementMachine: Add upper bound on number of attempts at splittin…
slavapestov Mar 21, 2022
bf779d3
RequirementMachine: Allow query operations to be invoked on requireme…
slavapestov Mar 22, 2022
24b6624
RequirementMachine: Move some code around in RequirementMachineReques…
slavapestov Mar 22, 2022
11b45ca
RequirementMachine: splitConcreteEquivalenceClass() uses getConcreteT…
slavapestov Mar 22, 2022
466d6a9
RequirementMachine: Refactor shouldSplitConcreteEquivalenceClasses() …
slavapestov Mar 22, 2022
4446f2a
RequirementMachine: Move some code out of RuleBuilder and into Requir…
slavapestov Mar 22, 2022
ff40f10
RequirementMachine: Allow RequirementMachine::isConcreteType() and ::…
slavapestov Mar 22, 2022
441fa16
RequirementMachine: Splitting concrete equivalence classes in protoco…
slavapestov Mar 22, 2022
527a519
AST: TypeMatcher needs to recurse into OpaqueTypeArchetypeTypes
slavapestov Mar 22, 2022
5acbeed
[debug-info-canonicalization] Add support for propagating debug info …
gottesmm Mar 13, 2022
37da960
[CSGen] Don't expect implicit casts to have type reprs
xedin Mar 22, 2022
5e4712f
Merge pull request #41956 from atrick/fix-ptr-reset
swift-ci Mar 22, 2022
07fc64e
AST: Fix a few more places where TypeMatcher would lose sugar
slavapestov Mar 22, 2022
02e4027
RequirementMachine: Print opaque archetypes using the 'stable' repres…
slavapestov Mar 22, 2022
00c33f8
[Demangling] Disable ShowAsyncResumePartial in SimplifiedUI (#41870)
kastiglione Mar 22, 2022
9604304
Downgrade more errors into warnings for actor inits.
kavon Mar 22, 2022
aa51bdf
Add `noasync` availability kind to available attr
etcwilde Jan 7, 2022
249c2a1
Typecheck noasync attr
etcwilde Jan 7, 2022
9003837
Fix remaining test issues
etcwilde Jan 13, 2022
110839e
Add cross-module test
etcwilde Mar 9, 2022
aa22e79
Add noasync attribute to changelog
etcwilde Mar 15, 2022
4e99cca
Merge pull request #41940 from tshortli/target-min-inlining-version-m…
tshortli Mar 22, 2022
0bb6a7b
SIL: Avoid serializing the bodies of the original copies of @_backDep…
tshortli Mar 22, 2022
b6c3ad3
Augment Test for Confusing ExpressibleByNilLiteral Case
CodaFi Mar 22, 2022
1b910f5
[NFC] Document the fields in an ABI generic context header
rjmccall Mar 22, 2022
c05e47d
Only use SIMD when stdlib vector types are available
Catfish-Man Mar 22, 2022
2fd4de4
[SIL-opaque] Removed [Unconditional]CheckedCastValue
atrick Mar 6, 2022
caaad42
[SIL-opaque] Various SILGen fixes
atrick Mar 5, 2022
4e3f0df
[SIL-opaque] use generated SILLocations
atrick Mar 16, 2022
a133549
[SIL-opaque] Add @in_guaranteed function argument support.
atrick Mar 20, 2022
3ec96fa
[SIL-opaque] Add an assert for open_existential_value.
atrick Mar 20, 2022
1625a44
[SIL-opaque] [NFC] clang-format AddressLowering.cpp
atrick Mar 20, 2022
4625f4a
Merge pull request #41958 from slavapestov/type-matcher-opaque-archetype
slavapestov Mar 23, 2022
5c5d2ea
Merge pull request #41945 from slavapestov/rqm-split-concrete-equiv-c…
slavapestov Mar 23, 2022
5810000
Merge pull request #41963 from CodaFi/literally-nothing
swift-ci Mar 23, 2022
439b362
[SIL-opaque] Cleanup and reenable SILGen unit tests
atrick Mar 2, 2022
636f3a7
Add a test file for combined SILGen + AddressLowering
atrick Mar 7, 2022
fd9ebb5
[SIL-opaque] Add address lowering test case.
atrick Mar 20, 2022
05fb8c7
Remove CheckedCastValue from Swift compiler sources.
atrick Mar 23, 2022
398de94
Merge pull request #41897 from Catfish-Man/we-control-the-horizontal
Catfish-Man Mar 23, 2022
cb3818e
[NFC] Split the basic target-layout logic into its own file
rjmccall Mar 22, 2022
e2332a3
[NFC] Move ValueWitnessTable layout into its own file
rjmccall Mar 22, 2022
bfff4ba
Merge pull request #41946 from kavon/warn-actorisolated-in-nonisolated
swift-ci Mar 23, 2022
e52c3a0
[MiscDiagnostics] Produce warnings about confusable `self` iff its ex…
xedin Mar 23, 2022
97cfeb1
Only define ValueStorageMap::dump in DEBUG.
nate-chandler Mar 23, 2022
57d1600
RequirementMachine: Better tests for concrete type requirements with …
slavapestov Mar 23, 2022
28e6822
Merge pull request #41970 from rjmccall/three-metadata-nfcs
rjmccall Mar 23, 2022
13c71c6
Merge pull request #40769 from etcwilde/ewilde/noasync-unavailability
etcwilde Mar 23, 2022
6918fbb
Merge pull request #41969 from xedin/rdar-90624344
xedin Mar 23, 2022
9d413b3
Merge pull request #41939 from xedin/rdar-87407899
xedin Mar 23, 2022
78de2fb
[NFC] Move generic contexts and metadata references into separate hea…
rjmccall Mar 23, 2022
1dabda8
Merge pull request #41961 from tshortli/dont-serialize-back-deployed-…
tshortli Mar 23, 2022
15772e4
[CSApply] Ajust expression rewriter to handle casts without reprs
xedin Mar 23, 2022
e9f0052
Merge pull request #41959 from gottesmm/alloc_stack_propagation_and_h…
gottesmm Mar 23, 2022
f9c689b
Merge pull request #41973 from nate-chandler/address_lowering/define-…
atrick Mar 23, 2022
a93a574
Merge pull request #41976 from rjmccall/generic-context-headers
swift-ci Mar 23, 2022
385c7f9
Merge pull request #41974 from slavapestov/rqm-opaque-archetype-tests
slavapestov Mar 23, 2022
e2d6f5a
[cmake] Include StdlibOptions when only building toolchain extras. (#…
drodriguez Mar 23, 2022
504a52a
Use SwiftStdlib availability
etcwilde Mar 23, 2022
743d82b
Merge pull request #41902 from dduan/dd/delete-six
shahmishal Mar 23, 2022
1a6d7c1
Merge pull request #41947 from atrick/opv-silgen
atrick Mar 23, 2022
c6de808
Merge pull request #41960 from xedin/csgen-casts-without-reprs
xedin Mar 23, 2022
db4a7e6
Merge pull request #41941 from apple/verify-fixit-alternation-docs
swift-ci Mar 23, 2022
93e8a35
[Serialization] Ignore the exported module name for XRefs
xymus Mar 15, 2022
cffe105
Merge pull request #41964 from Catfish-Man/single-instruction-multipl…
Catfish-Man Mar 23, 2022
d858ac3
Merge pull request #41984 from xymus/export-as-xref
xymus Mar 23, 2022
025ee1e
Merge pull request #41979 from etcwilde/ewilde/fix-availability-annot…
etcwilde Mar 23, 2022
9ac49cd
Merge remote-tracking branch 'apple/main' into katei/merge-main-2022-…
kateinoigakukun Mar 24, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@ _**Note:** This is in reverse chronological order, so newer entries are added to

## Swift 5.7

* [SE-0340][]:

It is now possible to make declarations unavailable from use in asynchronous
contexts with the `@available(*, noasync)` attribute.

This is to protect the consumers of an API against undefined behavior that can
occur when the API uses thread-local storage, or encourages using thread-local
storage, across suspension points, or protect developers against holding locks
across suspension points which may lead to undefined behavior, priority
inversions, or deadlocks.

* [SE-0343][]:

Top-level scripts support asynchronous calls.
Expand Down Expand Up @@ -9083,6 +9094,7 @@ Swift 1.0
[SE-0341]: <https://github.com/apple/swift-evolution/blob/main/proposals/0341-opaque-parameters.md>
[SE-0336]: <https://github.com/apple/swift-evolution/blob/main/proposals/0336-distributed-actor-isolation.md>
[SE-0343]: <https://github.com/apple/swift-evolution/blob/main/proposals/0343-top-level-concurrency.md>
[SE-0340]: <https://github.com/apple/swift-evolution/blob/main/proposals/0340-swift-noasync.md>

[SR-75]: <https://bugs.swift.org/browse/SR-75>
[SR-106]: <https://bugs.swift.org/browse/SR-106>
Expand Down
10 changes: 0 additions & 10 deletions SwiftCompilerSources/Sources/SIL/Instruction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -408,12 +408,6 @@ class UnconditionalCheckedCastInst : SingleValueInstruction, UnaryInstruction {
public override var mayTrap: Bool { true }
}

final public
class UnconditionalCheckedCastValueInst : SingleValueInstruction,
UnaryInstruction {
public override var mayTrap: Bool { true }
}

final public
class ConvertFunctionInst : SingleValueInstruction, UnaryInstruction {}

Expand Down Expand Up @@ -624,7 +618,3 @@ final public class CheckedCastBranchInst : TermInst, UnaryInstruction {

final public class CheckedCastAddrBranchInst : TermInst, UnaryInstruction {
}

final public class CheckedCastValueBranchInst : TermInst, UnaryInstruction {
}

2 changes: 0 additions & 2 deletions SwiftCompilerSources/Sources/SIL/Registration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ public func registerSILClasses() {
register(RefElementAddrInst.self)
register(RefTailAddrInst.self)
register(UnconditionalCheckedCastInst.self)
register(UnconditionalCheckedCastValueInst.self)
register(ConvertFunctionInst.self)
register(ThinToThickFunctionInst.self)
register(ObjCExistentialMetatypeToObjectInst.self)
Expand Down Expand Up @@ -140,5 +139,4 @@ public func registerSILClasses() {
register(AwaitAsyncContinuationInst.self)
register(CheckedCastBranchInst.self)
register(CheckedCastAddrBranchInst.self)
register(CheckedCastValueBranchInst.self)
}
12 changes: 11 additions & 1 deletion docs/Diagnostics.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ If you run into any issues or have questions while following the steps above, fe
(This section is specific to the Swift compiler's diagnostic engine.)

If the `-verify` frontend flag is used, the Swift compiler will check emitted diagnostics against specially formatted comments in the source. This feature is used extensively throughout the test suite to ensure diagnostics are emitted with the correct message and source location.

`-verify` parses all ordinary source files passed as inputs to the compiler to look for expectation comments. If you'd like to check for diagnostics in additional files, like swiftinterfaces or even Objective-C headers, specify them with `-verify-additional-file <filename>`. By default, `-verify` considers any diagnostic at `<unknown>:0` (that is, any diagnostic emitted with an invalid source location) to be unexpected; you can disable this by passing `-verify-ignore-unknown`.

An expected diagnostic is denoted by a comment which begins with `expected-error`, `expected-warning`, `expected-note`, or `expected-remark`. It is followed by:

Expand All @@ -150,6 +152,14 @@ An expected diagnostic is denoted by a comment which begins with `expected-error

- (Required) The expected error message. The message should be enclosed in double curly braces and should not include the `error:`/`warning:`/`note:`/`remark:` prefix. For example, `// expected-error {{invalid redeclaration of 'y'}}` would match an error with that message on the same line. The expected message does not need to match the emitted message verbatim. As long as the expected message is a substring of the original message, they will match.

- (Optional) Expected fix-its. These are each enclosed in double curly braces and appear after the expected message. An expected fix-it consists of a column range followed by the text it's expected to be replaced with. For example, `let r : Int i = j // expected-error{{consecutive statements}} {{12-12=;}}` will match a fix-it attached to the consecutive statements error which inserts a semicolon at column 12, just after the 't' in 'Int'. The special {{none}} specifier is also supported, which will cause the diagnostic match to fail if unexpected fix-its are produced.
- (Optional) Expected fix-its. These are each enclosed in double curly braces and appear after the expected message. An expected fix-it consists of a column range followed by the text it's expected to be replaced with. For example, `let r : Int i = j // expected-error{{consecutive statements}} {{12-12=;}}` will match a fix-it attached to the consecutive statements error which inserts a semicolon at column 12, just after the 't' in 'Int'.

* Insertions are represented by identical start and end locations: `{{3-3=@objc }}`. Deletions are represented by empty replacement text: `{{3-9=}}`.

* Line offsets are also permitted; for instance, `{{-1:12-+1:42=}}` would specify a fix-it that deleted everything between column 12 on the previous line and column 42 on the next line. (If the sign is omitted, it specifies an absolute line number, not an offset.)

* By default, the verifier ignores any fix-its that are *not* expected; the special `{{none}}` specifier tells it to verify that the diagnostic it's attached to has *only* the fix-its specified and no others.

* If two (or more) expected fix-its are juxtaposed with nothing (or whitespace) between them, then both must be present for the verifier to match. If two (or more) expected fix-its have `||` between them, then one of them must be present for the verifier to match. `||` binds more tightly than juxtaposition: `{{1-1=a}} {{2-2=b}} || {{2-2=c}} {{3-3=d}} {{none}}` will only match if there is either a set of three fix-its that insert `a`, `b`, and `d`, or a set of three fix-its that insert `a`, `c`, and `d`. (Without the `{{none}}`, it would also permit all four fix-its, but only because one of the four would be unmatched and ignored.)

- (Optional) Expected educational notes. These appear as a comma separated list after the expected message, enclosed in double curly braces and prefixed by 'educational-notes='. For example, `{{educational-notes=some-note,some-other-note}}` will verify the educational notes with filenames `some-note` and `some-other-note` appear. Do not include the file extension when specifying note names.
20 changes: 20 additions & 0 deletions docs/SIL.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2193,6 +2193,26 @@ parts::
return %1 : $Klass
}

Forwarding Address-Only Values
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Address-only values are potentially unmovable when borrowed. This
means that they cannot be forwarded with guaranteed ownership unless
the forwarded value has the same representation as in the original
value and can reuse the same storage. Non-destructive projection is
allowed, such as `struct_extract`. Aggregation, such as `struct`, and
destructive disaggregation, such as `switch_enum` is not allowed. This
is an invariant for OSSA with opaque SIL values for these reasons:

1. To avoid implicit semantic copies. For move-only values, this allows
complete diagnostics. And in general, it makes it impossible for SIL
passes to "accidentally" create copies.

2. To reuse borrowed storage. This allows the optimizer to share the same
storage for multiple exclusive reads of the same variable, avoiding
copies. It may also be necessary to support native Swift atomics, which
will be unmovable-when-borrowed.

Borrowed Object based Safe Interior Pointers
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down
Loading