Skip to content
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

[5.10][SE-0392] Back-deploy assertIsolation/assumeIsolation #70474

Conversation

tshortli
Copy link
Contributor

@tshortli tshortli commented Dec 14, 2023

  • Explanation: The assertIsolation/assumeIsolation operations on actors are back-deployable back to the introduction of concurrency. However, doing so revealed that SILGen and IRGen could disagree on the return type of swift_task_getMainExecutor(), so fix that too to unblock adoption of the @backDeployed attribute.
  • Radars/Issues: rdar://111880539, rdar://116472583, and Back-deploy Actor.assertIsolated and friends #66473
  • Scope: This PR makes several concurrency convenience functions available to programs with earlier deployment targets. Projects that adopt these conveniences and compile with deployment targets lower than a Swift 5.9 aligned OS may execute copies of the conveniences that have been emitted into the client, instead of the copies in the standard library. Additionally, this PR changes how the main executor is referenced during code generation, specifically in the main() function.
  • Risk: Low. The implementations of the assertIsolation and assumeIsolation APIs are not changing; only their back deployment eligibility has changed. The new codegen that uses a builtin to reference the main actor executor should be functionally equivalent to the previous codegen. The builtin was already used during IRGen previously and this change simply makes its use more consistent.
  • Testing: Existing tests in the compiler test suite already exercise the changes in this PR and continue to pass.
  • Reviewed By: @ktoso
  • main PR: [SE-0392] Back-deploy assertIsolation/assumeIsolation #70472

tshortli and others added 2 commits December 14, 2023 15:13
SILGen and IRGen would disagree on the return type of the
`swift_task_getMainExecutor()` runtime function if
`SILGenModule::getGetMainExecutor()` had ever been called. To address this,
consistently use the `buildMainActorExecutorRef` built-in and get rid of
`SILGenModule::getGetMainExecutor()`.

Resolves rdar://116472583
The assertIsolation/assumeIsolation operations on actors are
back-deployable back to the introduction of concurrency. Do so.

Resolves rdar://111880539
@tshortli tshortli requested a review from a team as a code owner December 14, 2023 23:15
@tshortli tshortli added 🍒 release cherry pick Flag: Release branch cherry picks swift 5.10 labels Dec 14, 2023
@tshortli
Copy link
Contributor Author

@swift-ci please test

@tshortli tshortli merged commit 766e653 into swiftlang:release/5.10 Dec 15, 2023
5 checks passed
@tshortli tshortli deleted the back-deploy-assertassume-isolation-5.10 branch December 15, 2023 05:27
@tshortli tshortli linked an issue Dec 15, 2023 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍒 release cherry pick Flag: Release branch cherry picks swift 5.10
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Back-deploy Actor.assertIsolated and friends
4 participants