[SIL] SILFunction: Always set actor isolation during initialization#88600
Open
xedin wants to merge 3 commits intoswiftlang:mainfrom
Open
[SIL] SILFunction: Always set actor isolation during initialization#88600xedin wants to merge 3 commits intoswiftlang:mainfrom
xedin wants to merge 3 commits intoswiftlang:mainfrom
Conversation
SIL functions should always have actor isolation set, otherwise it could lead to wrong deductions in optimization passes like `SendNonSendable` or `OptimizeHopToExecutor`. This is a first step to move isolation assignment into `SILFunction::create`.
Prevents situations when actor isolation ends up not being set un-intentionally i.e. when cloning, specializating, or creating thunks. The thunks get `unspecified` isolation at the moment.
It's always set during construction of the `SILFunction` now.
Contributor
Author
|
@swift-ci please test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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:
Previously we only had
SILFunction::{get, set}ActorIsolationand produced an optionalActorIsolation. This is unsafe because optimizations and diagnostics are relying on actor isolation being set and if it's not could make wrong decisions. This change addsActorIsolationparameter to builders andSILFunctionitself to make sure that it's always set to some value. For example, for optimization/specialization the actor isolation is going to be transferred from parent, for construction from SILDeclRef it would get set based on the underlying declaration, for thunks it's set tounspecifiedornonisolateddepending on the type of a thunk. This way all the new users would be forced to think about actor isolation.Scope:
Affects SILFunction construction/initialization directly and via SILFunctionBuilder pattern.
Issues:
N/A
Risk:
Very low. This is essentially NFC even though it modifies a few tests, there should be no observable behavior difference.
Testing:
Updated a few tests that didn't check whether isolation is set or not.