Skip to content

[concurrency] implement lowering of implicitly async calls #34917

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 2 commits into from
Dec 8, 2020

Conversation

kavon
Copy link
Member

@kavon kavon commented Dec 2, 2020

If a call is to a synchronous function that is isolated to a different actor, then the call is treated as implicitly async. An earlier PR #34678 implemented the first part of this, which is to mark such calls in the AST as being implicitly async. This PR finishes the implementation by lowering / expanding that annotation during SILGen.

Resolves rdar://71606265

@kavon kavon force-pushed the implicitly-async-silgen branch from 5b78192 to 3c6d27e Compare December 8, 2020 01:39
kavon added 2 commits December 7, 2020 17:40
implicitly-async calls are calls to synchronous
actor-isolated functions. Synchronous functions
cannot perform hop_to_executor, so implicitly
async calls have the convention that the caller
is responsible for switching to the right
executor prior to entering the actor-isolated
callee.

It follows naturally that the caller must then
switch back to the appropriate executor after
the implicitly-async call completed.

Now, if the caller is not isolated to a
_specific_ actor, then we are (currently)
_not_ emitting a hop to go back to the
caller's executor, because that caller's
executor is unspecified (and currently not
accessable in SIL). This behavior may change
in the future; tracked in rdar://71905765
@kavon kavon force-pushed the implicitly-async-silgen branch from 3c6d27e to 60fa93f Compare December 8, 2020 01:40
@kavon kavon requested review from eeckstein and DougGregor December 8, 2020 01:43
@kavon kavon marked this pull request as ready for review December 8, 2020 01:43
@kavon
Copy link
Member Author

kavon commented Dec 8, 2020

@swift-ci please smoke test

@kavon kavon merged commit 7dc50a1 into swiftlang:main Dec 8, 2020
@kavon kavon deleted the implicitly-async-silgen branch December 8, 2020 19:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant