-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Merge the concurrency-5.5-abi-2 branch into release/5.5 #37474
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
Merge the concurrency-5.5-abi-2 branch into release/5.5 #37474
Conversation
[AsyncLet] reimplemented with new ABI and builtins [AsyncLet] remove runChild; it is now asyncLetStart [AsyncLet] ending an async let cancels the task [AsyncLet] remove some commented out code [AsyncLet] silence issue on windows [Concurrency] Store child record when async let child task spawned [AsyncLet] reimplemented with new ABI and builtins [AsyncLet] remove runChild; it is now asyncLetStart [AsyncLet] ending an async let cancels the task [AsyncLet] remove some commented out code
The closure does not escape the startAsyncLet - endAsyncLet scope. Even though it's (potentially) running on a different thread. The substantial change in the runtime is to not call swift_release on the closure context if it's a non-escaping closure.
When the closure of startAsyncLet is no-escaping, the captured values (= the partial_apply arguments) must be kept alive until the endAsyncLet builtin. ClosureLifetimeFixup adds the generated mark_dependence as a second operand to endAsyncLet, which keeps all the arguments alive until this point.
- Introduce an UnownedSerialExecutor type into the concurrency library. - Create a SerialExecutor protocol which allows an executor type to change how it executes jobs. - Add an unownedExecutor requirement to the Actor protocol. - Change the ABI for ExecutorRef so that it stores a SerialExecutor witness table pointer in the implementation field. This effectively makes ExecutorRef an `unowned(unsafe) SerialExecutor`, except that default actors are represented without a witness table pointer (just a bit-pattern). - Synthesize the unownedExecutor method for default actors (i.e. actors that don't provide an unownedExecutor property). - Make synthesized unownedExecutor properties `final`, and give them a semantics attribute specifying that they're for default actors. - Split `Builtin.buildSerialExecutorRef` into a few more precise builtins. We're not using the main-actor one yet, though. Pitch thread: https://forums.swift.org/t/support-custom-executors-in-swift-concurrency/44425
and traffic in Optional<Builtin.Executor> in various places.
Previously, they were storing a low-bit flag that indicated that they were a default actor. Using an extra inhabitant frees up the low bit for future use without being conspicuously more expensive to check.
…5-abi-2 Conflicts: include/swift/Basic/Features.def
…ator. Also, do this for the initial slab for the task's allocator itself. This avoids memory allocations for async-lets. In case the async-task's memory demand does not exceed the initial slab size, it is now completely malloc-free. The refcount bits of an async-let task are initialized to "immortal" so that ARC operations don't have an effect on the task. (cherry picked from commit 075ad87)
This commit changes JobFlags storage to be 32bits, but leaves the runtime API expressed in terms of size_t. This allows us to pack an Id in the 32bits we freed up. The offset of this Id in the AsyncTask is an ABI constant. This way introspection tools can extract the currently running task identifier without any need for special APIs. (cherry picked from commit bbda706)
(cherry picked from commit 6ea3163)
…5.5-abi-2/update-checkout-scheme-concurrency-5.5-abi-2 Add scheme for concurrency-5.5-abi-2
@swift-ci Please test |
@swift-ci Please test Windows |
Asking for reviews from the contributors who made functionality changes on this branch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm for my changes
rdar://77564014
@swift-ci Please test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM looks good for the asynclet, task and locals changes 👍
Also includes a cherry-pick of #37060, which was meant to go into the 5.5 branch.