Skip to content

[Sema/SILGen] DynamicActorIsolation: Implement dynamic actor isolation checks for unsafe APIs #71261

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

Conversation

xedin
Copy link
Contributor

@xedin xedin commented Jan 31, 2024

Passing an actor isolated synchronous function value (either declaration
or a closure) to an API that erases actor isolation and comes from a module
that hasn't adopted Swift version 6 would result in runtime check
(implemented via a thunk) that makes sure that the function is called on
the expected executor when DynamicActorIsolation flag is enabled.

Resolves: rdar://116022277

@xedin
Copy link
Contributor Author

xedin commented Jan 31, 2024

@swift-ci please test

1 similar comment
@xedin
Copy link
Contributor Author

xedin commented Jan 31, 2024

@swift-ci please test

@xedin xedin force-pushed the introduce-thunks-for-runtime-check-func-refs branch from ecfa1da to bdf8399 Compare January 31, 2024 17:43
@xedin
Copy link
Contributor Author

xedin commented Jan 31, 2024

@swift-ci please test

@xedin
Copy link
Contributor Author

xedin commented Jan 31, 2024

@swift-ci please build toolchain

xedin added 10 commits February 1, 2024 13:28
… module

For imported modules the version is empty because they don't carry
this information.
To be used in situations when a global actor isolation is stripped
from a function type in argument positions and could be extended in
the future to cover more if needed.
The thunk is a reabstraction thunk with a custom prolog that
has a runtime precondition check that makes sure that concurrent
environment where the thunk is run matches that of a global
actor associated with the thunked type.
…s that require runtime check

Passing an isolated function value into an API that doesn't have full
static concurrency checking is unsafe and requires runtime checks
to make sure that function is always called in the expected context.
@xedin xedin force-pushed the introduce-thunks-for-runtime-check-func-refs branch from 397386a to 53b2d86 Compare February 1, 2024 22:14
@xedin
Copy link
Contributor Author

xedin commented Feb 1, 2024

@swift-ci please test

@xedin xedin merged commit a77d119 into swiftlang:main Feb 2, 2024
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