Commit Graph

1607 Commits

Author SHA1 Message Date
Konrad `ktoso` Malawski
97d2f4fd36 Fix pointer auth issues for discarding task group operation pointer (#65220) 2023-04-18 12:51:45 +09:00
Kavon Farvardin
8f13679582 add missing rename of Job -> ExecutorJob 2023-04-12 13:37:43 -07:00
Konrad `ktoso` Malawski
80b93863a9 [Concurrency] Rename Job to ExecutorJob, ease transition with typealias (#65006) 2023-04-11 14:52:10 +09:00
Konrad `ktoso` Malawski
b666fc672e [Executors] Remote distributed actors get "crash on enqueue" default executor (#64969) 2023-04-10 19:12:03 +09:00
Konrad `ktoso` Malawski
b8780c9d9e [Executors] Move assert/assume APIs onto actors; assumeIsolated() (#64812) 2023-04-04 07:44:43 +09:00
swift-ci
3be14e0a4a Merge pull request #64622 from kavon/bifurcate-moveonly-featureflag
Fix minimal stdlib builds with noncopyable types
2023-03-28 14:44:24 -07:00
Konrad `ktoso` Malawski
0586c14b60 [Concurrency] SerialExecutor.isSameExclusiveExecutionContext (#64604) 2023-03-28 15:56:28 +09:00
Kavon Farvardin
5c8447587f explicitly enable MoveOnly feature when building _Concurrency lib
We ran into an issue on minimal stdlib build configurations, because they
pull slightly older toolchains to build and test the stdlib. The noncopyable
`Job` type was adopted immediately after such types were enabled by default,
before the toolchain builds could catch up. Adding this flag to the build of
the `_Concurrency` lib should make things more robust when somewhat older
compilers are building this part of the stdlib.

part of resolving rdar://106849189
2023-03-24 16:00:22 -07:00
Kavon Farvardin
363448a0d7 bring back the noncopyable Job type in the _Concurrency lib
This reverts commit abe377ce68.

Co-authored-by: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
2023-03-24 08:58:40 -07:00
Konrad `ktoso` Malawski
abe377ce68 [Workaround][Concurrency] Mark Job as NOT moveonly until we fix moveonly types (#64536) 2023-03-23 07:43:51 +09:00
Konrad `ktoso` Malawski
345c221f56 [Concurrency] Distributed actor's unownedExecutor should be optional (#64499) 2023-03-22 08:40:41 +09:00
Konrad `ktoso` Malawski
e0877594da [Concurrency] Custom executors with move-only Job (#63569) 2023-03-18 14:02:43 +09:00
Konrad `ktoso` Malawski
5d2a311dda [Executors] assumeOnLocalDistributedActorExecutor (isolated Act) -> 2023-03-16 13:23:47 +09:00
Konrad `ktoso` Malawski
41f99fc2ae [Executors][Distributed] custom executors for distributed actor (#64237)
* [Executors][Distributed] custom executors for distributed actor

* harden ordering guarantees of synthesised fields

* the issue was that a non-default actor must implement the is remote check differently

* NonDefaultDistributedActor to complete support and remote flag handling

* invoke nonDefaultDistributedActorInitialize when necessary in SILGen

* refactor inline assertion into method

* cleanup

* [Executors][Distributed] Update module version for NonDefaultDistributedActor

* Minor docs cleanup

* we solved those fixme's

* add mangling test for non-def-dist-actor
2023-03-15 23:42:55 +09:00
Konrad `ktoso` Malawski
ac0c3b75c6 [Concurrency] Freeze JobPriority, comment that Flags location is assumed (#64267) 2023-03-10 16:49:37 +09:00
Kavon Farvardin
4c65c33668 Merge pull request #64211 from kavon/assumeOn-task2thread-guarding
guard assume on executor API against task-to-thread runtimes
2023-03-09 09:34:01 -08:00
Kavon Farvardin
c100fe01bc guard use of enqueueStealer when using actors-as-locks
skip escalation in this case.
2023-03-08 14:55:36 -08:00
Kavon Farvardin
f40d90f885 fix another unguarded use of MainActor 2023-03-08 14:12:13 -08:00
Kavon Farvardin
18d976f8fa guard assume on executor API against task-to-thread runtimes 2023-03-08 12:02:06 -08:00
Konrad `ktoso` Malawski
5fbdd8197d Minor mistake in group docs comment cocs snippet
We say in a comment here that we print the error and cancel, but we don't actually have the print below. This PR adds that missing print in the docs snippet.
2023-03-08 22:56:09 +09:00
swift-ci
f284e72956 Merge pull request #62201 from mdznr/documentation_grammar
[NFC] Correct grammar in documentation for `AsyncStream.Continuation.finish()`
2023-03-07 15:02:41 -08:00
Evan Wilde
2c49700ed5 Merge pull request #64054 from etcwilde/ewilde/startOnMainActor
Concurrency: swift_task_startOnMainActor
2023-03-06 18:57:51 -08:00
Evan Wilde
f8e1272097 Concurrency: appease the api-digester
Looks like simply putting the availability attribute on the extension
does not suffice. Putting the availability attr on the function itself
to appease the api-digester.
2023-03-06 13:33:22 -08:00
Evan Wilde
1bd1c468a0 Concurrency: Task.startOnMainActor
This patch adds an SPI to run the first partial function of a MainActor
asynchronous function on the MainActor synchronously. This is
effectively like the asynchronous program entrypoint behavior. The first
partial function is run synchronously. Following continuations are
enqueued for execution like any other asynchronous function.
2023-03-06 13:33:22 -08:00
Evan Wilde
9fd0f26112 Delete trailing whitespace in AsyncStreamBuffer.swift
Verifying that the ANSI color control sequences don't show up in CI
logs. AsyncStreamBuffer.swift emits warnings, so dirtying it will ensure
it gets rebuilt in CI.
2023-03-06 09:13:45 -08:00
Franz Busch
791b2a0298 Implement convenience factory methods for Async[Throwing]Stream (#62968)
* Implement convenience factory methods for Async[Throwing]Stream

This is the implementation for https://github.com/apple/swift-evolution/pull/1824

* Apply suggestions from code review

Co-authored-by: Konrad `ktoso` Malawski <konrad.malawski@project13.pl>

---------

Co-authored-by: Konrad `ktoso` Malawski <konrad.malawski@project13.pl>
2023-03-04 17:43:56 -08:00
Rokhini Prabhu
4c92890a42 Remove overly strict assert that only the thread which was previously running the task, can mark the task as no-longer running. 2023-03-03 18:04:26 -08:00
Konrad `ktoso` Malawski
93decb6141 [Concurrency] Complement assume... APIs with the assert and precondition ones (#64062) 2023-03-04 08:03:29 +09:00
Rokhini Prabhu
0bb5a89d56 Fixup isEnqueued call on actor state which really is isScheduled
Radar-Id: rdar://problem/101864092
2023-03-03 11:44:56 -08:00
Doug Gregor
1b3fda7857 Merge pull request #64060 from DougGregor/enable-swift-syntax-formatter 2023-03-03 06:24:29 -08:00
swift-ci
5fe47bf8fb Merge pull request #64030 from ktoso/wip-assume
[Concurrency] Add "assume on (actor) executor" APIs
2023-03-03 00:40:02 -08:00
swift-ci
814488f7db Merge pull request #64050 from ktoso/wip-continuation-docs-fix
[Concurrency] Fix continuation documentation about execution semantics
2023-03-02 23:19:27 -08:00
Doug Gregor
9074b94d5f Enable the Swift diagnostic formatter for standard library builds 2023-03-02 22:08:12 -08:00
Konrad `ktoso` Malawski
3eb04e24a2 fix complete_concurrency_keyword's too imprecise assertions 2023-03-03 14:16:03 +09:00
Konrad `ktoso` Malawski
c446f4cb12 review followup 2023-03-03 13:37:57 +09:00
Konrad `ktoso` Malawski
293440dbb2 remove underscore from assume funcs 2023-03-03 12:40:55 +09:00
Konrad `ktoso` Malawski
d0c68c0176 [Concurrency] Add "assume on (actor) executor" APIs 2023-03-03 12:40:55 +09:00
Evan Wilde
877d03f4f5 Merge pull request #61692 from etcwilde/ewilde/fix-noreturn-warning
Fix asyncMainDrainQueue noreturn warning
2023-03-02 18:21:38 -08:00
Konrad `ktoso` Malawski
8b2253cfbe [Concurrency] Fix continuation documentation about execution semantics 2023-03-03 09:45:55 +09:00
Evan Wilde
841fda5dbe Add asyncMainDrainQueue hook
The swift_task_asyncMainDrainQueue function acts as the entrypoint into
driving the main queues, ultimately running the whole program and acting
as the backing driver of the main actor. Making the function hookable
means that custom concurrency runtimes can implement their own async
entrypoints, allowing async top-level code and async-main to "just
work".
2023-03-01 22:16:23 -08:00
Evan Wilde
ec7a926148 Fix asyncMainDrainQueue noreturn warning
The async main drain queue function is noreturn, but was emitting a
warning due to the override compatibility returning the result of the
overridden function in the wrapper override function. To work around
this, I've added the `OVERRIDE_TASK_NORETURN` macro, which provides an
override point for noreturn functions in the concurrency library that
doesn't return the result from the wrapped function, avoiding the
warning. In the event that the function is not set, the macro is set to
the normal `OVERRIDE` with the return type set to `void`.
2023-03-01 17:08:41 -08:00
Rokhini Prabhu
9b6c873239 Escalate an actor if a job in the queue of the actor has been escalated.
Radar-Id: rdar://problem/101864092
2023-02-28 13:52:26 -08:00
Rokhini Prabhu
4515654a62 Remove redundant call to swift_dispatch_lock_override_end() since that
is only needed for acknowledging asynchronous overrides from other
threads, onto the thread itself. It is not needed for self-overrides.

Radar-Id: rdar://problem/101864092
2023-02-28 13:51:46 -08:00
Rokhini Prabhu
d63ce1372c Change memory barriers in actor runtime so that we have acquire upon
lock() and release on unlock() and use consume when are relying on
address dependency HW load ordering. Adjust tsan annotations to match.

Radar-Id: rdar://problem/101864092
2023-02-28 13:51:46 -08:00
Rokhini Prabhu
8a930ca7c7 Merge pull request #63919 from apple/rokhinip/105932276-track-task-enqueued-executor
Track  the executor that a task is enqueued in, in dependency records
2023-02-28 13:43:33 -08:00
Rokhini Prabhu
7dd16da3b1 Merge pull request #63916 from apple/rokhinip/105930505-updateStatusRecord-and-friends
Improve functionality available for manipulating status records.
2023-02-28 13:42:36 -08:00
swift-ci
0f3ece9b24 Merge pull request #63543 from ktoso/wip-custom-executor-priority
[Concurrency] UnownedJob.priority and TaskPriority gains description
2023-02-28 11:03:58 -08:00
Konrad `ktoso` Malawski
98c33a7b1e new init in extension must be @available explicitly 2023-03-01 00:08:17 +09:00
Konrad `ktoso` Malawski
be4caa5b93 [Docs][Concurrency] Fix documentation about cancellation, copy docs to a few methods (#63960) 2023-02-28 17:32:15 +09:00
Konrad `ktoso` Malawski
3ffb3397a3 [Docs][Concurrency] TaskGroup docs: waitForAll (non-)cancellation (#63956) 2023-02-28 17:31:41 +09:00