Skip to content

[1/3][Distributed] Make distributed thunks the witnesses, fix calls on generic DAs #59711

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 1 commit into from
Jun 27, 2022

Conversation

ktoso
Copy link
Contributor

@ktoso ktoso commented Jun 26, 2022

Implements calls on generic distributed actors, by fixing how the witness is found: it must be the thunk.

Resolves rdar://95829405

@ktoso ktoso added the distributed Feature → concurrency: distributed actor label Jun 26, 2022
@ktoso ktoso changed the title Wip generic distributed call clean [Distributed] Make distributed thunks the witnesses, fix calls on generic DAs Jun 26, 2022
@ktoso ktoso force-pushed the wip-generic-distributed-call-clean branch from d723fc2 to bacc5bf Compare June 26, 2022 02:40
@ktoso ktoso force-pushed the wip-generic-distributed-call-clean branch from bacc5bf to 1bfe1ca Compare June 26, 2022 06:00
@ktoso
Copy link
Contributor Author

ktoso commented Jun 26, 2022

@swift-ci please smoke test

@ktoso
Copy link
Contributor Author

ktoso commented Jun 26, 2022

@swift-ci please build toolchain

@ktoso ktoso force-pushed the wip-generic-distributed-call-clean branch 4 times, most recently from eedc751 to 203a190 Compare June 27, 2022 04:42
@@ -4791,6 +4791,9 @@ ERROR(distributed_actor_func_static,none,
ERROR(distributed_actor_func_not_in_distributed_actor,none,
"'distributed' method can only be declared within 'distributed actor'",
())
ERROR(distributed_method_requirement_must_be_async_throws,none, // FIXME(distributed): this is an implementation limitation we should lift
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

marked all sites where we emit this with rdar://95949498

@ktoso ktoso force-pushed the wip-generic-distributed-call-clean branch from 203a190 to 1e87ea7 Compare June 27, 2022 07:59
@ktoso ktoso force-pushed the wip-generic-distributed-call-clean branch from 1e87ea7 to 22b20af Compare June 27, 2022 08:09
@ktoso
Copy link
Contributor Author

ktoso commented Jun 27, 2022

@swift-ci please smoke test

@ktoso ktoso requested review from DougGregor and xedin and removed request for DougGregor June 27, 2022 14:55
@ktoso ktoso changed the title [Distributed] Make distributed thunks the witnesses, fix calls on generic DAs [1/3][Distributed] Make distributed thunks the witnesses, fix calls on generic DAs Jun 27, 2022
Copy link
Member

@DougGregor DougGregor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nits here, but overall this is an improvement and the type checker behavior accurately reflects the implementation behavior.

assert(systemTy &&
// NOTE: So we don't need a thunk in the protocol, we should call the underlying
// thing instead, which MUST have a thunk, since it must be a distributed func as well...
if (dyn_cast<ProtocolDecl>(DC)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: s/dyn_cast/isa/ (not important)

if (requirement.hasDecl()) {
if ((!getActorIsolation(requirement.getDecl()).isDistributedActor()) ||
(isa<FuncDecl>(requirement.getDecl()) &&
witness.getFuncDecl()->isDistributed())) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the last line was meant to be requirement.getFuncDecl()->isDistributed(), i.e., is the requirement distributed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes, thank you!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in #59722

@DougGregor DougGregor merged commit 0219611 into swiftlang:main Jun 27, 2022
@ktoso
Copy link
Contributor Author

ktoso commented Jun 27, 2022

Thanks for review, will address in the 3/3 PR 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
distributed Feature → concurrency: distributed actor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants