Commit Graph

580 Commits

Author SHA1 Message Date
Mishal Shah
b8cd763b21 Merge branch 'main' into bump-swift-version-to-6 2024-02-21 12:40:54 -08:00
Mishal Shah
b488702cc9 Merge remote-tracking branch 'origin/main' into bump-swift-version-to-6 2024-02-20 21:04:47 -08:00
Kavon Farvardin
f296d8e158 NCGenerics: mass XFAIL tests
It's easier to get a handle on regressions while working through
failures if the tests that are known to not pass are XFAIL'd for
NoncopyableGenerics.
2024-02-20 18:26:05 -05:00
Mishal Shah
96d61d3c5c Merge remote-tracking branch 'origin/main' into bump-swift-version-to-6 2024-02-20 14:31:55 -08:00
Konrad `ktoso` Malawski
f03ddf728b [Macros] Reproduce issue with peer+extension macro extension's methods not being checked as witnesses (#71717)
Co-authored-by: Pavel Yaskevich <pyaskevich@apple.com>
2024-02-20 00:50:29 -08:00
Konrad `ktoso` Malawski
551b07ba80 [Distributed] Fix _executeDistributedTarget ABI (#71725) 2024-02-19 21:23:11 -08:00
Mishal Shah
af112c1591 Update the Swift version to 6.0 from 5.11 2024-02-19 17:47:16 -08:00
Holly Borla
26621b804c [Concurrency] Enable optional isolated parameters. 2024-02-16 16:28:45 -08:00
Konrad `ktoso` Malawski
e9c7f3c382 [Distributed] Target identifiers for protocol calls (#70928) 2024-02-16 07:19:20 -08:00
Konrad `ktoso` Malawski
827e6a5708 [Distributed] Add DistributedProtocol macro (#71090) 2024-02-16 07:27:34 +09:00
Pavel Yaskevich
1909b12370 [SIL] Distributed: Remove logic related to ad-hoc requirements from SILFunction
Ad-hoc requirements are now obsolete by making `remoteCall`,
`record{Argument, ReturnType}`, `decodeNextArgument` protocols
requirements and injecting witness tables for `SerializationRequirement`
conformances during IRGen.
2024-02-12 14:26:30 -08:00
Pavel Yaskevich
4d4c80b8ec [IRGen] Distributed: Always invoke decodeNextArgument through witness thunk
`decodeNextArgument` is now a requirement, so thunks should be
always calling that instead of trying to dispatch directly.
2024-02-12 14:26:30 -08:00
Pavel Yaskevich
cdc9a01dc1 [Tests] NFC: Adjust distributed actor test-cases changed/improved due to new requirements 2024-02-12 14:26:30 -08:00
Slava Pestov
2ed50ec276 Sema: If the structural occurs check skips a witness, treat it as tautological
Fixes rdar://problem/122584912.
2024-02-10 17:20:14 -05:00
Holly Borla
5cb418a2a7 Merge pull request #71511 from hborla/explicit-isolation-expansion
[Concurrency] Make `#isolation` macro expansions explicit.
2024-02-09 15:44:33 -08:00
Holly Borla
1875817bdd [Concurrency] Make #isolation macro expansions explicit.
Macro expansions are never considered implicit. They have
valid source locations in their macro expansion buffer, they
do not cause implicit 'self' capture diagnostics, etc. This
fixes an issue where existing code that iterates over an async
sequence in an escaping closure would diagnose a use of implicit
'self' via the '#isolation' argument to 'next()'.
2024-02-09 12:05:16 -08:00
Hamish Knight
5d0ad81932 [test] Remove unnecessary --color flags
This is now the default.
2024-02-09 16:47:03 +00:00
Konrad `ktoso` Malawski
1d73afb296 [Distributed] Handle DA declared inside a generic type (#71492) 2024-02-08 21:32:34 -08:00
Ben Barham
a2c237b899 Merge pull request #71202 from finagolfin/isolation
[Test] Make sure macros are enabled for the tests that use the new #isolation macro
2024-02-08 08:41:39 -08:00
John McCall
dd90ae7416 Rename SIL's @isolated attribute to @sil_isolated.
We want to use @isolated in ordinary Swift, and while we could probably
make it coexist with this SIL use, doing so would be really inconvenient.
2024-02-03 01:51:36 -05:00
Slava Pestov
28f26216ee Sema: Refactor evaluateMembersRequest() to not call TypeChecker::checkConformance() 2024-01-31 21:56:57 -05:00
Konrad `ktoso` Malawski
bd19d937f0 [TaskExecutor] Remove underscore from new APIs (#71145) 2024-01-30 06:27:54 +09:00
Konrad `ktoso` Malawski
dfdbe457bf [Distributed] Support complex generic distributed actors in thunk gen (#70842) 2024-01-28 01:26:52 -08:00
Finagolfin
8e7a5c6e53 [Test] Make sure macros are enabled for the tests that use the new #isolation macro 2024-01-28 02:20:07 +05:30
Slava Pestov
5eb32261aa Merge pull request #71169 from slavapestov/one-more-round-of-fixes
One more round of associated type inference fixes
2024-01-26 17:32:00 -05:00
Slava Pestov
f5ccc3248d Update Distributed/actor_protocols.swift for minor diagnostic change with -enable-experimental-associated-type-inference 2024-01-25 21:55:43 -05:00
Slava Pestov
991a6de207 Merge pull request #71131 from slavapestov/conformance-checker-vs-type-witnesses-untangling
Sema: Decouple type witness resolution from the ConformanceChecker
2024-01-25 20:06:01 -05:00
Allan Shortlidge
fdc7ebddbc Tests: Make distributed_actor_custom_executor_availability.swift use an explicit deployment target.
Split distributed_actor_custom_executor_availability.swift into two tests, one
that only runs on existing platforms that support back deployment to Swift 5.7
aligned runtimes, and another test that is not restricted by platform that
tests behavior when deploying to a Swift 5.9 aligned runtime or later.
2024-01-24 22:21:51 -08:00
Allan Shortlidge
e0aa2e8a4b Tests: Make distributed_actor_accessor_thunks_64bit.swift less sensitive to deployment target. 2024-01-24 22:21:51 -08:00
Slava Pestov
9c077ec338 Sema: Consolidate calls to emitDelayedDiags() 2024-01-24 13:16:49 -05:00
Slava Pestov
ec7269da5c Sema: Clean up diagnoseMissingWitnesses() 2024-01-24 12:38:36 -05:00
Slava Pestov
4d7a22375b Fix typo in name of test file 2024-01-24 12:05:24 -05:00
Doug Gregor
5c83cae0df Merge pull request #71105 from DougGregor/silgen-hack-distributed-actor-as-actor
[SILGen] Ensure that we emit the distributed-actor-as-actor conformance
2024-01-23 22:36:17 -08:00
Michael Gottesman
c4622a235d Merge pull request #71099 from gottesmm/pr-387f6b4fba6f40c5cb78dd54f3fd718902f9d38d
[region-isolation] Make it so that we only propagate actor self if the callee takes self as isolated.
2024-01-23 20:47:17 -08:00
Doug Gregor
07c6b78540 [SILGen] Ensure that we emit the distributed-actor-as-actor conformance
The distributed-actor-as-actor conformance is synthesized by the
frontend, so make sure that when we access the API that exposes it
(asLocalActor), we be sure to mark the conformance as "used".

This is a very specific workaround for general problem with
compiler-synthesized conformances. SIL deserialization can bring in a
reference to a conformance late in the SIL pipeline, after the point at
which SILGen can create the conformance. We should be able to address
this systemically to remove the hack.
2024-01-23 19:32:47 -08:00
Michael Gottesman
bfc12c550c Fix another test 2024-01-23 16:24:53 -08:00
Michael Gottesman
6f3d45219a [ast] Represent a parameter's isolation at the SIL level.
I did this by adding flag on SILParamInfo.

rdar://121387872
2024-01-23 15:20:22 -08:00
Doug Gregor
f79a108e85 Implement support for #isolation for distributed actors
When using `#isolation` within a context that is isolated to a
distributed actor, resolve to an `asLocalActor` access to retrieve the
local actor corresponding to the distributed actor.
2024-01-23 13:47:03 -08:00
Doug Gregor
a25911ef8c Remove unnecessary Darwin-specific check 2024-01-22 21:13:19 -08:00
Doug Gregor
97ea19d191 Introduce a builtin and API for getting the local actor from a distributed one
When an actual instance of a distributed actor is on the local node, it is
has the capabilities of `Actor`. This isn't expressible directly in the type
system, because not all `DistributedActor`s are `Actor`s, nor is the
opposite true.

Instead, provide an API `DistributedActor.asLocalActor` that can only
be executed when the distributed actor is known to be local (because
this API is not itself `distributed`), and produces an existential
`any Actor` referencing that actor. The resulting existential value
carries with it a special witness table that adapts any type
conforming to the DistributedActor protocol into a type that conforms
to the Actor protocol. It is "as if" one had written something like this:

    extension DistributedActor: Actor { }

which, of course, is not permitted in the language. Nonetheless, we
lovingly craft such a witness table:

* The "type" being extended is represented as an extension context,
rather than as a type context. This hasn't been done before, all Swift
runtimes support it uniformly.

* A special witness is provided in the Distributed library to implement
the `Actor.unownedExecutor` operation. This witness back-deploys to the
Swift version were distributed actors were introduced (5.7). On Swift
5.9 runtimes (and newer), it will use
`DistributedActor.unownedExecutor` to support custom executors.

* The conformance of `Self: DistributedActor` is represented as a
conditional requirement, which gets satisfied by the witness table
that makes the type a `DistributedActor`. This makes the special
witness work.

* The witness table is *not* visible via any of the normal runtime
lookup tables, because doing so would allow any
`DistributedActor`-conforming type to conform to `Actor`, which would
break the safety model.

* The witness table is emitted on demand in any client that needs it.
In back-deployment configurations, there may be several witness tables
for the same concrete distributed actor conforming to `Actor`.
However, this duplication can only be observed under fairly extreme
circumstances (where one is opening the returned existential and
instantiating generic types with the distributed actor type as an
`Actor`, then performing dynamic type equivalence checks), and will
not be present with a new Swift runtime.

All of these tricks together mean that we need no runtime changes, and
`asLocalActor` back-deploys as far as distributed actors, allowing it's
use in `#isolation` and the async for...in loop.
2024-01-22 17:27:31 -08:00
Konrad `ktoso` Malawski
9eb84a4ecb [Distributed] add test for remoteCall on dist property (#71052) 2024-01-21 23:42:52 -08:00
Slava Pestov
24814c5e9d Merge pull request #71041 from slavapestov/refactor-conformance-checker-diagnostics
Refactor conformance checker diagnostics
2024-01-21 11:14:47 -05:00
Slava Pestov
525b6effc6 Sema: Use diagnoseOrDefer() in ConformanceChecker::ensureRequirementsAreSatisfied() 2024-01-21 08:34:41 -05:00
Konrad `ktoso` Malawski
1dec00a420 [TaskExecutors] Task initializer and withTaskExecutor parameter changes (#70783) 2024-01-20 11:03:26 +09:00
Konrad `ktoso` Malawski
13a42f4bce [Distributed] Allow isolated any DistributedActor (#70906) 2024-01-14 21:16:00 -08:00
Konrad `ktoso` Malawski
396ecdf5ed [Distributed] Destroy decoded parameters after executeDistributedTarget (#70806) 2024-01-11 11:56:14 +09:00
Mike Ash
99f4bad86f Merge pull request #70377 from mikeash/distributed-actor-remotecall-argument-labels-disable-use-os-stdlib
[Test] Mark distributed_actor_remoteCall_argument_labels.swift unsupported for use_os_stdlib.
2023-12-13 20:23:26 -05:00
Konrad `ktoso` Malawski
828f589be4 Initial Task Executor implementation Task(on:), addTask(on:) etc. (#68793)
Co-authored-by: John McCall <rjmccall@gmail.com>
2023-12-12 17:14:24 +09:00
Mike Ash
9eac772c21 [Test] Mark distributed_actor_remoteCall_argument_labels.swift unsupported for use_os_stdlib. 2023-12-11 12:41:53 -05:00
Pavel Yaskevich
dbf1146963 [Concurrency] NFC: Switch tests to use -strict-concurrency=complete instead of -warn-concurrency 2023-12-08 14:10:51 -08:00