Skip to content

[6.2][silgen] Make async_Main compatible with calling nonisolated(nonsending) functions. #82388

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 23, 2025

Conversation

gottesmm
Copy link
Contributor

@gottesmm gottesmm commented Jun 20, 2025

Explanation: This PR changes how SILGen emits the executor for async_Main so that it emits an actual a reference to the main actor instead of just the main actor executor. The reason why we do this is that in contrast to previously where we just needed an executor for the purposes of hopping, we now also need to be able to pass off main actor-ness as a bonafide actor as an isolated parameter to nonisolated(nonsending) functions. To effectuate this, I just changed the executor setup code to emit the direct reference to the actor instead of the executor.

Scope: This just changes how we setup the executor to use in async_Main. It will not impact any other code.

Resolves: rdar://153082633

Main PR: #82387

Risk: Low. This just changes how we setup the executor to use in async_Main. It will not impact any other code. It uses a very standard, known code path that is used in the rest of SILGen for this purpose.

Testing: Added compiler tests

Reviewer: @xedin

…ng) functions.

The problem is that async_Main was setting an executor as its main executor
instead of an actor. This patch fixes the issue by just grabbing the main actor
instead.

rdar://153082633
(cherry picked from commit 862ef62)
@gottesmm
Copy link
Contributor Author

@swift-ci test

@gottesmm gottesmm marked this pull request as ready for review June 22, 2025 18:06
@gottesmm gottesmm requested a review from a team as a code owner June 22, 2025 18:06
@gottesmm gottesmm changed the title [6,2][silgen] Make async_Main compatible with calling nonisolated(nonsending) functions. [6.2][silgen] Make async_Main compatible with calling nonisolated(nonsending) functions. Jun 22, 2025
@gottesmm gottesmm merged commit 8f3c0ae into swiftlang:release/6.2 Jun 23, 2025
5 checks passed
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.

2 participants