Commit Graph

580 Commits

Author SHA1 Message Date
Pavel Yaskevich
680698e099 [Distributed] Fix _executeDistributedFunction resume and result buffer (#40814)
* [Distributed] Adjust interface of `swift_distributed_execute_target`

Since this is a special function, `calleeContext` doesn't point to
a direct parent but instead both parent context (uninitialized)
and resume function are passed as last arguments which means that
`callContext` has to act as an intermediate context in call to accessor.

* [Distributed] Drop optionality from result buffer in `_executeDistributedTarget`

`RawPointer?` is lowered into a two arguments since it's a struct,
to make it easy let's just allocate an empty pointer for `Void` result.

* [Distributed] NFC: Update _remoteCall test-case to check multiple different result types
2022-01-12 23:18:40 +09:00
Konrad `ktoso` Malawski
9438cf6b2e [Distributed] Func metadata operations and implement executeDistributedTarget entry (#40605)
* [Distributed] Implement func metadata and executeDistributedTarget

dont expose new entrypoints

able to get all the way to calling _execute

* [Distributed] reimplement distributed get type info impls

* [Distributed] comment out distributed_actor_remoteCall for now

* [Distributed] disable test on linux for now
2022-01-09 23:55:06 +09:00
Pavel Yaskevich
375494b3fc [Distributed] IRGen: Fix method pointer retrieval
`getPointerToMethod()` should acoount for the fact that distributed
thunk is an async function, so direct pointer should be to "async
pointer" information instead of SIL function.
2021-12-22 18:11:01 -08:00
Pavel Yaskevich
bcf2d5a1aa [Distributed] IRGen: Make accessor thin and require actor as (last) guaranteed argument 2021-12-22 16:17:53 -08:00
Arnold Schwaighofer
9c2b91609a Mark test Distributed/Runtime/distributed_no_system_boom.swift as UNSUPPORTED on back_deployment_runtime
rdar://86779689
2021-12-21 12:14:14 -08:00
Pavel Yaskevich
d6d9b551fa [Distributed] Temporary disable accessor tests on Windows
I don't have access to Windows machine so there is no way for
me to debug and fix them.
2021-12-17 10:52:57 -08:00
Pavel Yaskevich
351300e1c3 [Distributed] Runtime/NFC: Split accessor thunk tests into 32/64 bit versions 2021-12-17 10:52:57 -08:00
Pavel Yaskevich
8d14443f94 [Distributed] Runtime: Fix accessor section test-case to support 32/64 bit platforms 2021-12-17 10:52:57 -08:00
Pavel Yaskevich
bc09fa3a2f [Distributed] NFC: Remove align 8 from the accessor thunks test-cases 2021-12-17 10:52:57 -08:00
Pavel Yaskevich
2180e4deed [Distributed] IRGen: Make sure that arguments extracted from buffer have correct ownership
Use parameter convention information to determine ownership of the extracted arguments.
2021-12-17 10:52:57 -08:00
Pavel Yaskevich
304f3db05b [Distributed] IRGen: Load arguments directly into argument explosion
It's incorrect to load from the pointer directly, instead accessor
should use `loadAsCopy` for loadable types.
2021-12-17 10:52:57 -08:00
Pavel Yaskevich
9b21742e58 [Distributed] Adjust accessor tests to match Windows/Linux section name correctly 2021-12-17 10:52:56 -08:00
Pavel Yaskevich
151bae110e [Distributed] NFC: Update accessor test-cases to use FakeActorSystem instead of Transport 2021-12-17 10:52:56 -08:00
Doug Gregor
1647cdd04c Merge pull request #40602 from DougGregor/sendable-diagnostics 2021-12-16 21:58:38 -08:00
Doug Gregor
a901892a1c Update test 2021-12-16 17:09:41 -08:00
Arnold Schwaighofer
5c969e6919 Disable Distributed/Runtime/distributed_actor_init_local.swift
It fails on some bots.

rdar://86543336
2021-12-16 08:37:26 -08:00
Doug Gregor
536b0367dd Merge pull request #40560 from DougGregor/conformance-cross-actor-sendable-checks 2021-12-14 23:08:14 -08:00
Doug Gregor
7db313bd35 Fix test case 2021-12-14 20:04:57 -08:00
Konrad `ktoso` Malawski
cee89ec541 [Distributed] DistributedActorSystem renaming and redesign (#40387)
* [Distributed] towards DistributedActorSystem; synthesize the id earlier, since Identifiable.id

* Fix execute signature to what Pavel is working with

* funcs are ok in sil

* fixed lifetime of id in inits

* fix distributed_actor_deinit

* distributed_actor_local

* update more tests

fixing tests

fix TBD test

fix Serialization/distributed

fix irgen test

Fix null pointer crashes

* prevent issues with null func ptrs and fix Distributed prorotocol test

* fix deinit sil test
2021-12-13 11:29:25 +09:00
Saleem Abdulrasool
7f67dcb1f9 test: enable async/Distributed tests on Windows
These were previously disabled due to the UB that caused the tests to
fail.  Now that this has been fixed, restore these tests to running
state in line with the other targets.
2021-11-20 08:24:25 -08:00
Saleem Abdulrasool
306662fd29 Concurrency: fix UB in DefaultActor initialization
This fixes a latent UB instance in the `DefaultActor` implementation
that has haunted the Windows target.  The shared constructor for the
type caused an errant typo that happened to compile which introduced
UB but happened to work for the non-Windows cases.  This happened to
work for the other targets as `swift::atomic` had a `std::atomic` at
on most configurations, and the C delegate for the Actor initializer
happened to overlap and initialize the memory properly.  The Windows
case used an inline pointer width value but would be attempted to be
initialized as a `std::atomic`.  Relying on the overlap is unsafe to
assume, and we should use the type's own constructor which delegates
appropriately.
2021-11-19 10:34:41 -08:00
Konrad `ktoso` Malawski
451b8a6fe5 Merge branch 'main' into wip-distributed-private 2021-11-18 12:07:30 +09:00
Konrad `ktoso` Malawski
79a3b580d2 [Distributed] After all, a private func may be distributed 2021-11-18 12:05:17 +09:00
Konrad `ktoso` Malawski
f191730d81 [Distributed] workaround for inout removal fixit 2021-11-16 21:41:47 +09:00
Konrad `ktoso` Malawski
069942eed7 [Distributed] Improve error message style 2021-11-16 21:09:35 +09:00
Konrad `ktoso` Malawski
a67824fbd7 [Distributed] More descriptive kind usage for error messages 2021-11-16 16:50:28 +09:00
Konrad `ktoso` Malawski
18bf8e01f9 [Distributed] Ban inout, varargs from dist funcs 2021-11-16 16:50:00 +09:00
Konrad `ktoso` Malawski
a78d1bc47a Merge pull request #40179 from ktoso/wip-dist-func-protos
[Distributed] Improve error messages for protocol conformances
2021-11-16 15:07:35 +09:00
Konrad `ktoso` Malawski
f58b133a84 [Distributed] adjust conformance error messages a bit 2021-11-15 11:11:55 +09:00
Konrad `ktoso` Malawski
fcd93a5c1d [Distributed] Improve error messages for protocol conformances 2021-11-14 15:34:50 +09:00
Pavel Yaskevich
2c66b20523 [Distributed] NFC: Add a test-case for different async let configurations 2021-11-12 12:41:30 -08:00
swift-ci
65f09cce9d Merge pull request #39708 from kavon/actor-init-fixes 2021-11-05 15:52:33 -07:00
swift-ci
52df427a63 Merge pull request #40061 from DougGregor/existential-isolated-parameter-fix 2021-11-05 10:56:40 -07:00
Kavon Farvardin
5888e72daf leftover fixes due to AnyActorTransport change 2021-11-05 10:38:19 -07:00
Doug Gregor
04cd00e325 Update distributed tests for diagnostic change 2021-11-05 07:44:18 -07:00
Doug Gregor
b37f77f350 Merge pull request #40033 from DougGregor/distributed-actors-without-existentials
Eliminate required type erasure from distributed actors
2021-11-04 22:31:51 -07:00
Kavon Farvardin
c5320c0206 express resignIdentity in SILGen as an unwind-only clean-up
turning it into a clean-up covers both failable and throwing initializers.

resolves rdar://84535066
2021-11-04 21:07:26 -07:00
Kavon Farvardin
b203f5b13b remove instances of redundant nonisolated on actor initializers
these appearances are considered errors, because it's already
implied by a convenience init. For a synchronous initializer,
we can't really describe _what_ it's isolation is right now,
but it is not just "nonisolated". So, we leave it ambiguous
and say that "nonisolated" is invalid.
2021-11-04 19:04:13 -07:00
Kavon Farvardin
a1daee59e4 a distributed actor's convenience init should be treated as nonisolated 2021-11-04 19:04:13 -07:00
Konrad `ktoso` Malawski
61a1bc2a6c [Distributed] remove public default AnyActorTransport alias
The previously set public AnyActorTransport was a temporary thing,
and instead we want to set this in every module that declares such
actors.
2021-11-04 15:54:56 +09:00
swift-ci
4592132f0b Merge pull request #40045 from apple/wip-missing-skiptest 2021-11-03 19:52:25 -07:00
Konrad `ktoso` Malawski
fc0e549387 [Distributed] Distributed tests should not run in backdeployment 2021-11-04 07:09:53 +09:00
Doug Gregor
4aacc1c99e Make the actor identity type an associated type of ActorTransport
Eliminate the use of the type-erased `AnyActorIdentity` within the
distributed actor protocol by exposing the identity type of an actor
transport as an associated type, `Identity`, which is then used to
refer to all actors that have that transport.

Retain `AnyActorIdentity`, because it remains useful for type-erasing
actor transports, especially as the `Identity` type for
`AnyActorTransport`. For now, make it the default type of `Identity`:
this helps smooth over the transition from use of `AnyActorIdentity`,
but we might want to remove this to make use of the type-erased forms
always opt-in.
2021-11-03 08:58:21 -07:00
Doug Gregor
c2ba06c3d2 Make the actor transport an associated type of the DistributedActor protocol.
Eliminate the required use of existentials in distributed actors by
introducing the `Transport` associated type into the
`DistributedActor` protocol. Each distributed actor has a known
(concrete) actor transport type, reducing storage requirements and
transport dynamism when it isn't needed.

Distributed actors can manually specify their `Transport` associated
type or pick up a default by looking for a type named
`DefaultActorTransport`. A library that vends an actor transport can
make create a public typealias `DefaultActorTransport` referring to
its transport, so importing that library and defining a distributed
actor will use that library's transport.

Introduce a type-erased `AnyActorTransport` type to provide an
explicitly dynamic actor transport. This is still an important option,
e.g., for cases where one wants to be able to dynamically change the
transport for testing or different kinds of deployment. For now, we
default to this transport in the library (via `DefaultActorTransport`),
but we may very well want to eliminate this because it will be
ambiguous with client libraries that vend their own
`DefaultActorTransport`.
2021-11-01 22:37:33 -07:00
Konrad `ktoso` Malawski
841bd4260a [Concurrency][Distributed] Handle more cases of isolation, protocols, better errors (#39895)
* [Distributed] Handle more cases of isolation, protocols, better errors/notes

* [Concurrency] Actor sync funcs can conform to async protocol reqs

* [Distributed] Offer fixit to add DistributedActor to type when dist func is encountered

* [Distributed] Witness protocol reqs in dist actor protocol extensions

* try to address availability issues
2021-11-01 19:13:33 +09:00
Karoy Lorentey
8e154a415a Merge pull request #39962 from lorentey/concurrency-availability
[stdlib] Introduce availability macros
2021-10-31 14:23:57 -07:00
Doug Gregor
3da14e6f65 Refactor and generalize distributed actor transport SIL generation.
Refactor the code that generates SIL to call into the distributed actor
transport to eliminate duplication and better cope with concrete actor
transports. Centralize the knowledge of which actor transport is used
with a given distributed actor type.
2021-10-30 21:49:35 -07:00
Karoy Lorentey
5e78c3bfdc [Distributed] Restore availability macro definitions & update to 5.6
The _Distributed module is being introduced in Swift 5.6, so its definitions need to come with matching availability. (We don't have version numbers for the associated OS releases, so we need to use placeholder 9999 availability for these.)
2021-10-28 16:41:37 -07:00
Karoy Lorentey
47956908b7 [Concurrency] SwiftStdlib 5.5 ⟹ SwiftStdlib 5.1 (usages)
The concurrency runtime now deploys back to macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, which corresponds to the 5.1 release of the stdlib.

Adjust macro usages accordingly.
2021-10-28 14:36:36 -07:00
Artem Chikin
e961e40c9b Disable flaky distributed_actor_init_local.swift test.
Example failure:
https://ci.swift.org/job/oss-swift-incremental-RA-macos-apple-silicon//1575/console
2021-10-26 10:21:07 -07:00