Skip to content

[Distributed] always emit the distributed thunk #39056

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
Aug 26, 2021

Conversation

ktoso
Copy link
Contributor

@ktoso ktoso commented Aug 26, 2021

I don't really know why the !hasFunction was needed but I think it was copied from other code which was doing it this way.

With this guard though we would not emit the thunk in situations where it is necessary and cause missing symbols (missing SIL), like this:

 1465 // super Chatter.chatterJoined(room:chatter:)
 1466 sil @$s15FishyActorsDemo7ChatterC13chatterJoined4room0E0yAA8ChatRoomC_ACtFTd : $@convention(method) @async (@guaranteed ChatRoom, @guaranteed Chatter, @guaranteed Chatter) -> @error Error
 1467

where we'd want the full function:

// super Chatter.chatterJoined(room:chatter:)
sil [thunk] [ossa] @$s15FishyActorsDemo7ChatterC13chatterJoined4room0E0yAA8ChatRoomC_ACtFTd : $@convention(method) @async (@guaranteed ChatRoom, @guaranteed Chatter, @guaranteed Chatter) -> @error Error {
// %0 "room"                                      // users: %21, %24
// %1 "chatter"                                   // users: %21, %24
// %2 "self"                                      // users: %21, %20, %24, %3
bb0(%0 : @guaranteed $ChatRoom, %1 : @guaranteed $Chatter, %2 : @guaranteed $Chatter):
  %3 = init_existential_ref %2 : $Chatter : $Chatter, $AnyObject // user: %5
  // function_ref swift_distributed_actor_is_remote

removing the if solves the issue. I could not reproduce the issue in small files but only in a swiftpm project though, so not super sure how to add a test for it 🤔

(functions from some silly example app)

@ktoso ktoso added the distributed Feature → concurrency: distributed actor label Aug 26, 2021
@ktoso
Copy link
Contributor Author

ktoso commented Aug 26, 2021

@swift-ci please smoke test and merge

@ktoso ktoso force-pushed the wip-always-emit-distributed-thunk branch from 1f766bf to 923aeac Compare August 26, 2021 05:35
@swift-ci swift-ci merged commit e270ab4 into swiftlang:main Aug 26, 2021
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