Commit Graph

267 Commits

Author SHA1 Message Date
Konrad 'ktoso' Malawski
284c060d0a [Distributed] thread-safety also for parameter type metadata
We had fixed this bug in https://github.com/swiftlang/swift/pull/79381
but missed to realize the same problem existed for parameters as well.

This corrects the swift_func_getParameterTypeInfo impl, and also removes
the entire "unsafe" method, we no longer use it anywhere.

Resolves rdar://146679254
2025-04-26 21:30:13 +09:00
Konrad 'ktoso' Malawski
9f0f4777c3 Review followup, cleanup test 2025-04-21 12:02:49 +09:00
Konrad 'ktoso' Malawski
957a95be63 [Distributed] Distributed actor usage through protocol with lib-evo must work
This corrects how we were dealing with dispatch thunks -- mostly be
removing a lot of special casing we did but doesn't seem necessary and
instead we correct and emit all the necessary information int TBD.

This builds on  https://github.com/swiftlang/swift/pull/74935 by further refining how we fixed that issue, and adds more regression tests. It also removes a load of special casing of distributed thunks in library evolution mode, which is great.

Resolves and adds regression test for for rdar://145292018

This is also a more proper fix to the previously resolved but in a not-great-way which caused other issues:
- resolves rdar://128284016
- resolves rdar://128310903
2025-04-18 11:21:01 +09:00
Konrad 'ktoso' Malawski
af04c84c2d [Distributed] Minor test cleanup 2025-04-09 10:39:24 +09:00
Konrad `ktoso` Malawski
97be02d5b2 [Distributed] Dont emit TBD also for distributed thunks (#80526)
* [Distributed] Accessor must be available cross module in resilient mode

This is an important fix for libraries using @Resolvable in resilient
libraries. Without the fix we're missing an accessor and this will fail
some remote calls which make use of remote calls on resolvable
protocols. This would manifest as missing accessor error thrown by the
executeDistributedTarget function.

resolves rdar://148224780

* Disable test on windows since %env not supported

* [Distributed] Dont emit TBD also for distributed thunks

This resolves pedantic "all" TBD validation issues, i.e. we dont emit
unexpected records anymore - we would before as we only checked for
is_distributed but we also want to skip those for is_distributed_thunk

resolves rdar://128284016
2025-04-07 06:55:19 -07:00
Konrad `ktoso` Malawski
f21d029b82 [Distributed] Accessor must be available cross module in resilient mode (#80523)
* [Distributed] Accessor must be available cross module in resilient mode

This is an important fix for libraries using @Resolvable in resilient
libraries. Without the fix we're missing an accessor and this will fail
some remote calls which make use of remote calls on resolvable
protocols. This would manifest as missing accessor error thrown by the
executeDistributedTarget function.

resolves rdar://148224780

* Disable test on windows since %env not supported
2025-04-07 02:09:23 -07:00
Mike Ash
1de24cce80 [Test] Clean up leftover comments in distributed_actor_func_calls_without_touching_returnType_metadata_first.swift. 2025-02-17 10:18:01 -05:00
Konrad `ktoso` Malawski
d8f89bd948 [Distributed] improved return type metadata test and dont allow partial metadata 2025-02-15 18:15:10 +09:00
Konrad `ktoso` Malawski
62155f380d [Distributed] Improve getting return type metadata for distributed invocations
rdar://141313340
2025-02-15 11:27:06 +09:00
Mykola Pokhylets
5ac1cba8d1 Handle versioning of the IsolatedDeinit feature 2024-12-12 16:41:02 +09:00
Mykola Pokhylets
bc80529d02 Revert "Merge pull request #77438 from swiftlang/revert-77364-mpokhylets/non-experimental-isolated-deinit"
This reverts commit 11781a5fd1, reversing
changes made to 2ee2f1eb2c.
2024-12-12 16:41:02 +09:00
Konrad `ktoso` Malawski
746720c67b [Distributed] additional test coverage 2024-12-04 15:18:49 +09:00
Konrad `ktoso` Malawski
7189aded61 [Distributed] minor cleanups, remove dump=always from tests 2024-12-03 14:59:16 +09:00
Konrad `ktoso` Malawski
f48384bc7e [Distributed] Correct distributed accessor mangling for protocol calls
This is a crucial fix without which we can crash on some distributed
protocol declarations with @Resolvable. We cannot "just" use a String to
represent the "fake base" of the thunks, and must instead find the
$Target macro generated type and use it as the base of the thunk's
mangling.

Calls are made in such way that record for the protocol requirement:
`$s4main28GreeterDefinedSystemProtocolP5greetSSyYaKFTEHF` points at
`$$s4main29$GreeterDefinedSystemProtocolC5greetSSyYaKFTE` which makes a
dispatch through the _apropriate_ witness table.
And the record for the $witness named e.g.
`$s4main29$GreeterDefinedSystemProtocolC5greetSSyYaKFTEHF` points to
`$s4main28GreeterDefinedSystemProtocolPAA11Distributed01_F9ActorStubRzrlE5greetSSyYaKFTE`
which is an extension method: `distributed thunk (extension in main):main.GreeterDefinedSystemProtocol< where A: Distributed._DistributedActorStub>.greet() async throws -> Swift.String`,
this very specific design allows us to call the "right method" on the
recieving end of a remote call where we do not know the recipient type.
2024-12-03 14:59:15 +09:00
Konrad `ktoso` Malawski
a98a30d404 [Distributed] More tests for primary associated types in protocols 2024-12-03 14:59:15 +09:00
Konrad `ktoso` Malawski
aadc67ec0e Revert "Make IsolatedDeinit non-experimental" 2024-11-07 09:59:00 +09:00
Mykola Pokhylets
c139d1b1a7 Make IsolatedDeinit non-experimental 2024-11-05 12:19:01 +01:00
Daniel Rodríguez Troitiño
ba68faaed5 [test] Mark tests that use experimental/upcoming features as such
Find all the usages of `--enable-experimental-feature` or
`--enable-upcoming-feature` in the tests and replace some of the
`REQUIRES: asserts` to use `REQUIRES: swift-feature-Foo` instead, which
should correctly apply to depending on the asserts/noasserts mode of the
toolchain for each feature.

Remove some comments that talked about enabling asserts since they don't
apply anymore (but I might had miss some).

All this was done with an automated script, so some formatting weirdness
might happen, but I hope I fixed most of those.

There might be some tests that were `REQUIRES: asserts` that might run
in `noasserts` toolchains now. This will normally be because their
feature went from experimental to upcoming/base and the tests were not
updated.
2024-11-02 11:46:46 -07:00
Allan Shortlidge
75bad99f78 Tests: Remove -disable-availability-checking in Distributed tests.
Use the `%target-swift-5.X-abi-triple` substitutions to compile the tests for
deployment to the minimum OS versions required for the APIs used in the tests,
instead of disabling availability checking.
2024-10-20 09:07:13 -07:00
Allan Shortlidge
cb578172ea Tests: Remove -disable-availability-checking in more tests that use concurrency.
Use the `%target-swift-5.1-abi-triple` substitution to compile the tests for
deployment to the minimum OS versions required for use of _Concurrency APIs,
instead of disabling availability checking.
2024-10-19 12:35:20 -07:00
Allan Shortlidge
082f0ac4b5 Tests: Use a more natural spelling for ABI triple lit substitutions.
`%target-swift-5.8-abi-triple` instead of `%target-swift-abi-5.8-triple`, for
example.
2024-10-18 10:11:36 -07:00
Konrad `ktoso` Malawski
41d8962783 Revert "Revert "Revert "[Distributed] remote calls over-retain returned values""" 2024-10-04 06:53:43 +09:00
Konrad `ktoso` Malawski
f45f683f24 Merge pull request #76627 from swiftlang/revert-76623-revert-76595-wip-release-dist-execute-return 2024-10-03 19:15:59 +09:00
Konrad `ktoso` Malawski
62b04be2fa Revert "Revert "[Distributed] remote calls over-retain returned values"" 2024-09-21 14:50:35 +09:00
Konrad `ktoso` Malawski
9779137dc9 Revert "[Distributed] remote calls over-retain returned values" 2024-09-21 13:58:43 +09:00
Konrad `ktoso` Malawski
a12420a739 [Distributed] Must deinitialize return value of remoteCall
resolves rdar://136338200
resolves rdar://136313477
2024-09-20 14:33:46 +09:00
Konrad `ktoso` Malawski
2fd6f0043c add more experimental IsolatedDeinit flags to tests 2024-09-18 13:16:10 +09:00
Konrad `ktoso` Malawski
a6bc0e6759 temporary -experimental flag for IsolatedDeinit 2024-09-18 12:52:37 +09:00
Konrad `ktoso` Malawski
7d1ce789ad Revert "Revert "Isolated synchronous deinit"" 2024-09-17 17:35:38 +09:00
Alex Hoppen
c5aa49ba64 Revert "Isolated synchronous deinit" 2024-09-03 18:11:26 -07:00
Mykola Pokhylets
56fca2ad26 Fixed test/Distributed/Runtime/distributed_actor_deinit.swift in optimized mode 2024-09-03 09:47:13 +02:00
Mykola Pokhylets
50b1313175 Merge branch 'main' into mpokhylets/isolated-deinit
# Conflicts:
#	lib/SILGen/SILGenDistributed.cpp
#	lib/Sema/TypeCheckConcurrency.cpp
2024-08-15 16:58:43 +02:00
Pavel Yaskevich
343e0c7228 [Tests/Distributed] NFC: distributed_actor_protocol_call_resilient_lib test cannot be run remotely
The test depends on dynamic libraries that a rebuilt on the host
and are not transferred to the remote machine.

Resolves: rdar://132714652
2024-08-07 15:51:48 -07:00
Konrad `ktoso` Malawski
1869174cb5 Harden new distributed_actor_protocol_call_resilient_lib test for lib search paths (#75561) 2024-07-30 22:37:55 +09:00
Konrad `ktoso` Malawski
eb675c222e [Distributed] Correct tbd handling for distributed thunks (#74935) 2024-07-26 16:52:18 +09:00
Konrad `ktoso` Malawski
e53cd7d079 [Distributed] Handle #isolation param in DA as known to not cross isolation (#75327)
The isolation checker was assuming that one can only be isolated to a
specific var, but that's not true for distributed actors -- because the
default parameter emitted by #isolation is a method call -- converting
the self into an any Actor.

We must handle this in isolation checker in order to avoid thinking
we're crossing isolation boundaries and making methods implicitly async
etc, when we're actually not.

resolves rdar://131874709
2024-07-19 09:47:24 +09:00
Mykola Pokhylets
1304f81a04 Fixed CI builds 2024-07-11 21:54:43 +02:00
Mykola Pokhylets
816d62c972 Merge remote-tracking branch 'upstream/main' into mpokhylets/isolated-deinit
# Conflicts:
#	include/swift/Basic/Features.def
#	lib/SILGen/SILGenDestructor.cpp
#	test/Concurrency/flow_isolation.swift
#	test/abi/macOS/arm64/concurrency.swift
#	test/abi/macOS/x86_64/concurrency.swift
2024-07-11 13:11:59 +02:00
Mykola Pokhylets
e9173ff2f4 Make sure legacy executor checking mode is always used in swift_task_deinitOnExecutor() 2024-07-11 13:09:08 +02:00
Mykola Pokhylets
4d0b624866 Make deinit non-isolated by default
Failing: Distributed/Runtime/distributed_actor_deinit.swift
2024-07-11 13:09:08 +02:00
Mykola Pokhylets
9dcea15d21 Fixed tests on Linux, Windows and older MacOS versions 2024-07-11 13:09:07 +02:00
Mykola Pokhylets
7505cd20dd Updated unit tests 2024-07-11 13:09:07 +02:00
Mykola Pokhylets
c28df0dc05 Don't isolate deinit of remote actor proxies 2024-07-11 13:09:07 +02:00
Mykola Pokhylets
b4a1aab20d Updated Distributed/Runtime/distributed_actor_deinit.swift to check for isolation 2024-07-11 13:09:07 +02:00
Mykola Pokhylets
62dbc6c966 Fixed some tests. Using extract_executor SIL instruction instead of custom code. 2024-07-11 13:09:06 +02:00
Tim Kientzle
4470ed71ac Update executor test
The test previously checked for a message that is no longer
emitted.  Drop it.
2024-07-09 13:31:49 -07:00
Konrad `ktoso` Malawski
168bc7b454 [Concurrency] Fix how we obtain DA-as-A conformance for cross module
Resolves rdar://127206143
2024-05-28 13:37:21 +09:00
Pavel Yaskevich
e6b445b8d1 [SE-0428] NFC: Rename _DistributedProtocol macro into Resolvable
The proposal was [accepted with modifications](https://forums.swift.org/t/accepted-with-modifications-se-0428-resolve-distributedactor-protocols/71366)

The decision was made to change the spelling of the attached macro
in the proposal from @DistributedProtocol to `@Resolvable`
(or `@Distributed.Resolvable` if disambiguation is needed).
2024-04-22 14:18:11 -07:00
Konrad `ktoso` Malawski
efd8cbf978 [Distributed] Add more tests for implicit Codable on distributed actors 2024-04-17 11:53:05 +09:00
Konrad `ktoso` Malawski
460a030860 [Distributed] Avoid infinite recursion in distributed thunk on protocol extensions (#73032) 2024-04-15 03:43:49 -07:00