Skip to content

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

Merged
merged 19 commits into from
May 19, 2021

Conversation

rjmccall
Copy link
Contributor

@rjmccall rjmccall commented May 18, 2021

Also includes a cherry-pick of #37060, which was meant to go into the 5.5 branch.

ktoso and others added 16 commits April 30, 2021 17:50
[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
@rjmccall
Copy link
Contributor Author

@swift-ci Please test

@rjmccall
Copy link
Contributor Author

@swift-ci Please test Windows

@rjmccall rjmccall requested review from ktoso, eeckstein and fredriss May 18, 2021 17:10
@rjmccall
Copy link
Contributor Author

Asking for reviews from the contributors who made functionality changes on this branch

Copy link
Contributor

@eeckstein eeckstein left a 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

rjmccall and others added 3 commits May 18, 2021 16:13
)

I assume there's a common underlying problem for this and a lot of
other concurrency tests that are disabled on Windows.
@rjmccall
Copy link
Contributor Author

@swift-ci Please test

Copy link
Contributor

@ktoso ktoso left a 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 👍

@rjmccall rjmccall merged commit 9084d4b into swiftlang:release/5.5 May 19, 2021
@rjmccall rjmccall deleted the merge-abi-2-into-5.5 branch May 19, 2021 01:55
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.

6 participants