[6.2][silgen] Make async_Main compatible with calling nonisolated(nonsending) functions. #82388
+38
−22
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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