Skip to content

[SIL] SILFunction: Always set actor isolation during initialization#88600

Open
xedin wants to merge 3 commits intoswiftlang:mainfrom
xedin:harden-sil-function-actor-isolation-propagation
Open

[SIL] SILFunction: Always set actor isolation during initialization#88600
xedin wants to merge 3 commits intoswiftlang:mainfrom
xedin:harden-sil-function-actor-isolation-propagation

Conversation

@xedin
Copy link
Copy Markdown
Contributor

@xedin xedin commented Apr 21, 2026

  • Explanation:

    Previously we only had SILFunction::{get, set}ActorIsolation and produced an optional ActorIsolation. 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 adds ActorIsolation parameter to builders and SILFunction itself 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 to unspecified or nonisolated depending 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.

xedin added 3 commits April 21, 2026 12:21
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.
@xedin xedin requested a review from gottesmm April 21, 2026 23:57
@xedin xedin requested a review from a team as a code owner April 21, 2026 23:57
@xedin
Copy link
Copy Markdown
Contributor Author

xedin commented Apr 22, 2026

@swift-ci please test

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