Commit Graph

132998 Commits

Author SHA1 Message Date
swift-ci
94de12b022 Merge pull request #41788 from tshortli/back-deploy-accessors
SILGen: Fix accessor functions with `@_backDeploy`
2022-03-11 14:51:33 -08:00
nate-chandler
58b414d211 Merge pull request #41781 from nate-chandler/lexical_lifetimes/di-moves-end_borrow
[DI] Fixup alloc_box borrow scope ends.
2022-03-11 13:15:47 -08:00
Doug Gregor
b962b6f2c0 Merge pull request #41786 from DougGregor/opened-archetypes-back-in-your-context
Stop mapping opened archetypes "out of context".
2022-03-11 13:06:29 -08:00
Allan Shortlidge
c1e326cbb0 SILGen: Fix SILGen for accessor functions with @_backDeploy. Previously, the @_backDeploy attribute was ignored when generating SIL for accessors on declarations with the attribute since the accessor decls themselves were not directly annotated.
Also, emit an error when `@_backDeploy` is applied to coroutine accessors since they are not supported yet.

Resolves rdar://90112441
2022-03-11 11:07:04 -08:00
Rintaro Ishizaki
30a7ec1b3a Merge pull request #41674 from rintaro/sema-codablesynth-rdar89150202
[CodeSynthesis] Improve synthesized `Decodable.init(from:)` for enums
2022-03-11 09:42:49 -08:00
Doug Gregor
bd6f27bd55 Stop mapping opened archetypes "out of context".
These opened archetypes need to be bound within their context, so any mapping out of
the context will need to be explicit and map to newly-created generic parameters.
2022-03-11 09:27:48 -08:00
Alex Lorenz
5fb34b4f1b Merge pull request #40995 from hyp/function-to-cxx-thunk
[interop][SwiftToC++] print C++ interface for top-level Swift functions
2022-03-11 09:10:45 -08:00
Saleem Abdulrasool
ca25261f73 Merge pull request #41710 from compnerd/intrinsics
visualc: add new `_visualc_intrinsics` module
2022-03-11 08:51:10 -08:00
Doug Gregor
c979b9fb66 Merge pull request #41763 from etcwilde/ewilde/warn-concurrency-async-top-level
Make toplevel vars MainActor with `-warn-concurrency`
2022-03-11 08:44:29 -08:00
Nate Chandler
05e643ba04 [DI] Fixup alloc_box borrow scope ends.
After https://github.com/apple/swift/pull/40793, alloc_boxes all have
their lifetimes protected by a lexical borrow scope.  In that PR, DI had
been updated to see through begin_borrow instructions from a project_box
to a mark_uninitialized.  It did not, however, correct the end_borrow
instructions when destroy_values of mark_uninitializeds were replaced
with destroy_addrs of project_boxes.  That is done here.

In a bit more detail, in the following context

    %box = alloc_box
    %mark_uninit = mark_uninitialized %box
    %lifetime = begin_borrow [lexical] %mark_uninit
    %proj_box = project_box %lifetime

When it is not statically known whether a field is initialized, we are
replacing the instruction

      // before
      destroy_value %mark_uninit
      // after

with the following diamond

      // before
      %initialized = load
      cond_br %initialized, yes, no

    yes:
      destroy_addr %proj_box
      br bottom

    no:
      br bottom

    bottom:
      dealloc_box %box
      br keep_going

    keep_going:
      // after

Doing so is problematic, though, because by SILGen construction the
destroy_value is always preceded by an end_borrow:

      end_borrow %lifetime
      destroy_value %mark_uninit

Previously, that end_borrow remained above the

      %initialized = load

instruction in the above.  That was invalid because the the newly
introduced

      destroy_addr %proj_box

was a use of the borrow scope (%proj_box is a projection of the
begin_borrow) and consequently must be within the borrow scope.

Note also that it would not be sufficient to simply emit the diamond
before the end_borrow.  The end_borrow must come before the destruction
of the value whose lifetime it is protecting (%box), and the diamond
contains the instruction to destroy that value (dealloc_box) in its
bottom block.

To resolve this issue, just move the end_borrow instruction from where
it was to before the dealloc box.  (This is actually done by moving it to
the top of the diamond's "continue" block prior to the emission of that
dealloc_box instruction.)

rdar://89984216
2022-03-11 08:29:34 -08:00
Konrad `ktoso` Malawski
ee7b94104b Merge pull request #41783 from xedin/rdar-90129442
[Distributed] IRGen: Don't emit accessor for distributed thunk specia…
2022-03-11 21:46:12 +09:00
swift-ci
59b9794c55 Merge pull request #41727 from ktoso/wip-implicit-codable
[Distributed] Implicit Codable conformance for distributed actors
2022-03-11 03:23:22 -08:00
Konrad `ktoso` Malawski
fab04637f2 adjust test since other features were merged since 2022-03-11 18:44:11 +09:00
Konrad `ktoso` Malawski
b86bb0ddeb fix require-explicit-sendable 2022-03-11 18:07:14 +09:00
Konrad `ktoso` Malawski
6d502fc042 [Distributed] Implicit Codable conformance for Dist Actors
[Witness] implement dump() on witness
2022-03-11 18:07:14 +09:00
Holly Borla
d3702bacbb Merge pull request #41664 from hborla/redundant-requirements 2022-03-11 01:03:51 -08:00
Pavel Yaskevich
b243d64c61 [Distributed] IRGen: Don't emit accessor for distributed thunk specializations
Only synthesized `async throws` version is directly accessible remotely.

Resolves: rdar://90129442
2022-03-11 01:02:37 -08:00
Doug Gregor
07bb2b1df5 Merge pull request #41779 from DougGregor/extend-cocoaarray-buffer 2022-03-10 20:07:22 -08:00
Doug Gregor
459fb371f9 Merge pull request #41768 from DougGregor/emit-unnamed-isolated-params 2022-03-10 20:07:07 -08:00
swift-ci
a024e8fc5f Merge pull request #41602 from ktoso/wip-better-error
[Distributed] better diagnostics for missing actor system typealias
2022-03-10 19:45:21 -08:00
Konrad `ktoso` Malawski
f2d60e16f2 [Distributed] add note explaining DefaultDistributedActorSystem 2022-03-11 11:09:57 +09:00
Doug Gregor
ea89407304 Extend the lifetime of the buffer while copying from a _CocoaArrayWrapper
Fixes rdar://90108215.
2022-03-10 18:03:07 -08:00
Kavon Farvardin
25370d2530 Merge pull request #41776 from ktoso/wip-disable-opt
[Distributed] Disable some tests on optimized builds until we fix
2022-03-10 18:06:45 -07:00
Konrad `ktoso` Malawski
d42593a866 [Distributed] better diagnostics for missing actor system typealias 2022-03-11 10:01:38 +09:00
Konrad `ktoso` Malawski
58f0a1c5ca [Distributed] Disable some tests on optimized builds until we fix 2022-03-11 09:29:49 +09:00
Kavon Farvardin
5f42dd544f Merge pull request #41775 from xedin/disable-64-bit-test-on-32bit-simulators
[Distributed] NFC: Allow 64-bit distributed test only on x86_64 and arm64
2022-03-10 17:15:24 -07:00
Pavel Yaskevich
3b97bd5fb2 [Distributed] NFC: Allow 64-bit distributed test only on x86_64 and arm64 2022-03-10 16:08:42 -08:00
Slava Pestov
f014e9ff37 Merge pull request #41766 from slavapestov/test-rdar89921930.swift
Add testcase for fixed circular reference issue: rdar://89921930
2022-03-10 16:46:12 -05:00
Holly Borla
7ce6504b93 [RequirementMachine] Avoid passing the requirement error vector through
initialization of the rewrite system.

Instead, the rewrite system can determine trivially redundant requirements
by finding structural requirements with no associated rewrite rules.
2022-03-10 13:13:50 -08:00
Doug Gregor
323238fc79 Merge pull request #41760 from DougGregor/print-sendable-typereprs 2022-03-10 12:56:21 -08:00
Puyan Lotfi
09cdd36c0a [c++-interop] For failed imports in ClangImporter, cache them regardless. (#41173)
As per SR-14137 this caches entries in ImportedDecls even when the
import failed.

Also have to mention I did this based on Thomas's PR #36747.

This should help us better handle complex templates and dependant types.
2022-03-10 10:33:04 -08:00
Alex Lorenz
ebcf2f707a [interop] fixup the interop build test substitutions 2022-03-10 10:19:06 -08:00
Doug Gregor
1466afcf44 Ensure that emit unnamed isolated parameters
... because we need to be able to hop to their actors.
Fixes rdar://86753732.
2022-03-10 09:45:03 -08:00
Egor Zhdan
9e919fdd1d Merge pull request #41765 from apple/egorzhdan/cxx-test-linux
[cxx-interop] Enable a test on Linux
2022-03-10 09:42:00 -08:00
Alex Lorenz
07a1f569c6 [interop] add target-interop-clangxx test expansion to build C++ file with /MD msvc mode 2022-03-10 09:27:05 -08:00
Alex Lorenz
846fdb5307 [interop] add target-build-swift-link-cxx option for windows to link correctly 2022-03-10 08:05:52 -08:00
Slava Pestov
cf47090715 Add testcase for fixed circular reference issue: rdar://89921930 2022-03-10 10:32:25 -05:00
Konrad `ktoso` Malawski
5ab8e0834d [Distributed] Reimplement distributed call thunks completely in AST (#41616)
* [Distributed] dist actor always has default executor (currently)

* [Distributed] extra test for missing makeEncoder

* [DistributedDecl] Add DistributedActorSystem to known SDK types

* [DistributedActor] ok progress on getting the system via witness

* [Distributed] allow hop-to `let any: any X` where X is DistActor

* [Distributed] AST: Add an accessor to determine whether type is distributed actor

- Classes have specialized method on their declarations
- Archetypes and existentials check their conformances for
  presence of `DistributedActor` protocol.

* [Distributed] AST: Account for distributed members declared in class extensions

`getConcreteReplacementForProtocolActorSystemType` should use `getSelfClassDecl`
otherwise it wouldn't be able to find actor if the member is declared in an extension.

* [Distributed] fix ad-hoc requirement checks for 'mutating'

[PreChecker] LookupDC might be null, so account for that

* [Distributed] Completed AST synthesis for dist thunk

* [Distributed][ASTDumper] print pretty distributed in right color in AST dumps

* wip on making the local/remote calls

* using the _local to mark the localCall as known local

* [Distributed] fix passing Never when not throwing

* fix lifetime of mangled string

* [Distributed] Implement recordGenericSubstitution

* [Distributed] Dont add .

* [Distributed] dont emit thunk when func broken

* [Distributed] fix tests; cleanups

* [Distributed] cleanup, move is... funcs to DistributedDecl

* [Distributed] Remove SILGen for distributed thunks, it is in Sema now!

* [Distributed]  no need to check stored props in protocols

* remote not used flag

* fix mangling test

* [Distributed] Synthesis: Don't re-use AST nodes for `decodeArgument` references

* [Distributed] Synthesis: Make sure that each thunk parameter has an internal name

* [Distributed/Synthesis] NFC: Add a comment regarding empty internal parameter names

* [Distributed] NFC: Adjust distributed thunk manglings in the accessor section test-cases

* cleanup

* [Distributed] NFC: Adjust distributed thunk manglings in the accessor thunk test-cases

* review follow ups

* xfail some linux tests for now so we can land the AST thunk

* Update distributed_actor_remote_functions.swift

Co-authored-by: Pavel Yaskevich <xedin@apache.org>
2022-03-10 23:58:23 +09:00
Egor Zhdan
231af68205 [cxx-interop] Enable a test on Linux
This test doesn't actually rely on the C++ stdlib, I think it was disabled accidentally.

It currently passes on Linux.
2022-03-10 13:26:25 +00:00
Alastair Houghton
0d87a1084d Merge pull request #41746 from al45tair/eng/PR-89787540
Add a build option for the concurrency tracing feature.
2022-03-10 10:29:00 +00:00
Evan Wilde
d2c3e464e8 Make toplevel vars MainActor with warn-concurrency
This is the last part to implement SE-0343. When `-warn-concurrency` is
passed to the compiler invocation, we want to protect top-level
variables behind the MainActor regardless of whether the top-level is an
asynchronous context. Note that this does not make the top-level an
asynchronous context, but it does annotate the top-level as being a
main-actor-protected context.
2022-03-09 23:57:57 -08:00
Holly Borla
0085eb0dfe [RequirementMachine] Separate setting the explicit bit and the requirement
ID for a rewrite rule.
2022-03-09 21:22:53 -08:00
Alex Lorenz
1d3b68208e [interop][SwiftToC++] fix execution tests to hopefully link correctly on windows 2022-03-09 20:44:16 -08:00
Alex Lorenz
79533bb1c9 Merge pull request #41761 from hyp/fix-docs-typo
[docs] NFC, fix typo CppInteropability -> CppInteroperability
2022-03-09 20:24:05 -08:00
Slava Pestov
1ff3fda53f Merge pull request #41757 from slavapestov/protocol-self-reference-fixes
Sema: Fix a couple of issues related to variance of protocol 'Self'
2022-03-09 23:07:46 -05:00
Holly Borla
4b55c30fad [RequirementMachine] Instead of recording redundant requirements and other
diagnostics in the rewrite system, pass down the 'errors' vector from the
top-level requests.
2022-03-09 18:18:43 -08:00
Alex Lorenz
e05b011eb0 [docs] NFC, fix typo CppInteropability -> CppInteroperability 2022-03-09 18:10:58 -08:00
Doug Gregor
a6b586ded7 Ensure that we print @Sendable when printing TypeReprs.
Fixes rdar://85453819.
2022-03-09 17:51:36 -08:00
nate-chandler
4343d940ba Merge pull request #41751 from nate-chandler/mem2reg/bail-on-load-take-complex-projections
[Mem2Reg] Skip load [take] of cast projections.
2022-03-09 17:14:34 -08:00
nate-chandler
009ed74b09 Merge pull request #41753 from nate-chandler/lexical_lifetimes/lexical_destroy_addr_hoisting/pointer-handling
[SSADestroyHoisting] Pointer handling.
2022-03-09 17:12:00 -08:00