Commit Graph

986 Commits

Author SHA1 Message Date
Jonathan Grynspan
c8ef200b5b SuspendingClock on Windows does not suspend (#63225) 2023-01-27 18:44:15 -08:00
Konrad `ktoso` Malawski
99fb37f678 [Concurrency] Fix too optimistic TaskGroup bail-out-when-empty, (#63016)
* [Concurrency] Fix too optimistic bail-out-when-empty, discarding group
may need to emit an error out of such waitAll attempt, if a previous
error was already stored.

* [Concurrency] DiscardingTG error thrown from body always wins

* Offering body error must be done while holding lock

* Must not modify waitingTask context outside lock

* wip on trying to fix by changing the offer

* fix bug in resuming tasks in offer/resume task in discarding group

* Fix #63147 waitForAll impl in ThrowingTaskGroup, used to not wait enough

rdar://104507347

* done

* debug

* explicitly declare virtual destructors

* detach child task after filling result; dont mutate context outside of lock

* Add pending count overflow protection to TaskGroup

* unlock async_taskgroup_void_neverConsumingTasks again rdar://104332560

* missing include on windows for error reporting

* fix ARM_ARCH_7K workaround snippet
2023-01-27 19:00:26 +09:00
Rokhini Prabhu
17b1ada520 Add extra comments around memory barriers in Actor runtime atomics logic
Radar-Id: rdar://problem/88093007
2023-01-18 10:43:07 -08:00
Konrad `ktoso` Malawski
53682358d0 [Concurrency] Fix DiscardingTaskGroup in TASK_TO_THREAD (#63009) 2023-01-13 22:57:33 +09:00
swift-ci
8456a7e371 Merge pull request #62954 from kavon/tweak-atomics
Small fix for atomics when completing a future
2023-01-11 17:21:31 -08:00
Kavon Farvardin
ce3da795aa completeFuture should have acquire-release for the exchange
When a completed task updates the queue head to announce
that it's been completed, it only did an acquire exchange.

By also having it also do a release, we will ensure that
prior writes done by the completed task, before the task is
marked completed, will be correctly ordered as happening
before any subsequent reads by tasks waiting on that
completion status.

Co-authored-by: John McCall <rjmccall@apple.com>
2023-01-11 14:11:47 -08:00
Doug Gregor
9e76023546 Add BuiltinCreateTaskGroupWithFlags feature and use it to guard the builtin 2023-01-11 13:47:28 -08:00
swift-ci
93a0a6d905 Merge pull request #62914 from ktoso/wip-task-group-twotypes
[Concurrency] DiscardingTaskGroup (rev 3)
2023-01-11 01:37:33 -08:00
Konrad `ktoso` Malawski
4b90cdbe5c Revert "cleanup"
This reverts commit 128e2b2099.
2023-01-11 13:03:22 +09:00
Konrad `ktoso` Malawski
128e2b2099 cleanup 2023-01-11 12:40:25 +09:00
Konrad `ktoso` Malawski
6d63cf4994 fix cast type in getting task record 2023-01-11 11:55:52 +09:00
Allan Shortlidge
087aacc9fd [TaskLocals] Avoid use of defer in back deployed functions in the standard library.
Older versions of the 5.8 compiler have a bug when generating SIL for functions with `@_backDeploy` containing defer blocks (https://github.com/apple/swift/pull/62444) and for now we need the standard library interface to be compatible with those older compilers.

Resolves rdar://104045168
2023-01-10 10:44:15 -08:00
Allan Shortlidge
c7c806f768 [TaskLocals] Remove use of @inlinable with @_backDeploy temporarily. 2023-01-09 10:59:53 -08:00
Konrad `ktoso` Malawski
6f33f2af88 remove even more duplicated methods 2023-01-09 14:42:43 +09:00
Konrad `ktoso` Malawski
f09cef20d9 more cleanup 2023-01-09 14:09:13 +09:00
Konrad `ktoso` Malawski
7845de85c7 remove duplicated status logic 2023-01-09 13:18:23 +09:00
Konrad `ktoso` Malawski
6f38910058 DiscardingTaskGroup now shares some implementation with "Accumulating" TaskGroup 2023-01-09 11:35:04 +09:00
Alejandro Alonso
382510fa50 Rename Reflection library to RemoteInspection (#62846) 2023-01-06 13:21:32 -05:00
Konrad `ktoso` Malawski
e37b998c56 implement simple rethrowing logic, however body throw always wins 2023-01-05 21:42:20 +09:00
Konrad `ktoso` Malawski
2eaaf352de complete impl, except body throws 2023-01-05 20:13:05 +09:00
Konrad `ktoso` Malawski
60ee652695 more docs 2023-01-05 16:19:06 +09:00
Konrad `ktoso` Malawski
7ac5b407a6 move to DiscardingTaskGroup 2023-01-05 16:19:05 +09:00
Konrad `ktoso` Malawski
ce8aacef98 fix abi 2023-01-05 16:19:05 +09:00
Konrad `ktoso` Malawski
2652862229 prepare for cancellation handling 2023-01-05 16:19:05 +09:00
Konrad `ktoso` Malawski
54dec38a34 initial complete impl 2023-01-05 16:19:05 +09:00
Konrad `ktoso` Malawski
f8b85015c1 prepare flags
wip on options

implement discardResults as a flag passed to grout init
2023-01-05 16:19:05 +09:00
Konrad `ktoso` Malawski
1a3403524c [Concurrency] Optimize Void task group, to not store completed tasks anymore 2023-01-05 16:19:05 +09:00
Brandon Williams
e7fc16013e Add Clock.sleep(for:). (#61222) 2023-01-04 20:04:23 -05:00
Evan Wilde
e88e947272 Merge pull request #62712 from etcwilde/ewilde/zipping-zippers-zip
Add zippering support
2023-01-03 21:45:33 -08:00
Kuba (Brecka) Mracek
e9d1d3096a Stop using SWIFT_STDLIB_SINGLE_THREADED_CONCURRENCY under SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY (#62735)
Using single-threaded concurrency was a temporary solution, now that the task-to-thread model actually supports multiple threads, let's switch off of it. Instead, let's introduce a "global executor none" option (implicitly set under the task-to-thread model) to denote that the concurrency model is not using a global executor.

rdar://99448771
2023-01-03 15:24:57 -08:00
Evan Wilde
f8a54181a9 Zipper all the things!
This patch goes through and adds zippering and the swift module
dependencies to a bunch of pieces of the swift runtimes. Here's to
hoping I hit everything that needed to be hit. :D

With this patch, I'm seeing the appropriate modules under
lib/swift/maccatalyst, so things seem to be working right.
2022-12-22 13:41:59 -08:00
Alex Martini
45aea1e2e1 Merge pull request #62685 from Jager-yoo/fix-concurrency-doc
[stdlib] Correct actual print outputs in Concurrency files
2022-12-22 09:25:35 -08:00
Rokhini Prabhu
28493d01be Merge pull request #62716 from apple/eng/PR-103426321-mutex-initialization
[Task-to-Thread] Make sure to explicitly initialize the drainLock in DefaultActorImpl::initialize
2022-12-21 09:15:55 -08:00
Rokhini Prabhu
1ba0462c27 [Task-to-Thread] Make sure to explicitly initialize the drainLock in
DefaultActorImpl::initialize or we could end up waiting on a garbage
lock value

Radar-Id: rdar://problem/103426321
2022-12-20 16:47:48 -08:00
Jager-yoo
9b2b8b3a49 [stdlib] Correct actual print outputs in Concurrency files 2022-12-19 23:40:03 +09:00
Saleem Abdulrasool
db21566651 Merge pull request #62432 from mhjacobson/freebsd-implement-clock-functions
Concurrency: implement clock functions for FreeBSD
2022-12-18 09:25:40 -08:00
PriyaAvhad
5d0a509d7b Merge pull request #62435 from PriyaAvhad/pavhad/86100601-stealer-support-for-actor-runtime
Stealer support for actor runtime.
2022-12-16 00:37:07 +05:30
Konrad `ktoso` Malawski
387d36242d [Concurrency] Fix missing inherit executor on withTaskCancellationHandler (#62546) 2022-12-13 21:45:11 +09:00
Konrad `ktoso` Malawski
f9c2bc0402 Apply suggestions from code review
Co-authored-by: Doug Gregor <dgregor@apple.com>
2022-12-13 10:39:46 +09:00
Konrad `ktoso` Malawski
342ce7ea19 cleaning up attributes 2022-12-12 12:02:31 +09:00
Konrad `ktoso` Malawski
d122fd68fa add _backDeploy and availability necessary for it 2022-12-09 17:46:34 +09:00
Konrad `ktoso` Malawski
b3c335798d Better fix, using inheriting executor 2022-12-09 10:22:48 +09:00
Konrad `ktoso` Malawski
2178d9893f [Concurrency] tasklocal withValue inside actor is safe 2022-12-09 10:22:47 +09:00
Priya Avhad
d792c07fdc Stealer support for actor runtime. 2022-12-07 21:04:45 +05:30
Matt Jacobson
da855ce116 Concurrency: implement clock functions for FreeBSD
Match OpenBSD in both swift_get_time and swift_get_clock_res.
2022-12-07 02:34:59 -05:00
Erik Eckstein
525550644c concurrency runtime: fix unused variable/label warnings 2022-11-21 19:50:39 +01:00
Matt Zanchelli
1a570e2b99 Correct grammar in documentation for AsyncStream.Continuation.finish() 2022-11-18 18:09:05 -08:00
Erik Eckstein
77fd3a7004 runtime: fix a wrong fall-through caused by an assert(false)
Replace the `assert(false)` with `swift_unreachable`.
This is more robust in release builds where the `assert(false)` is a no-op and would result in a wrong fall-though to the next switch case.
Fixes a warning in release builds.
2022-11-14 20:40:56 +01:00
swift-ci
627dc1f69c Merge pull request #61911 from apple/rokhinip/99977665-continuations-support
Implement continuations in task-to-thread model.
2022-11-09 20:16:14 -08:00
Rokhini Prabhu
b2f51dd3de Implement continuations in task-to-thread model.
This is done using a condition variable upon which the awaiting thread
will block if the continuation has not be resumed by the point of await.
The resuming thread will signal this condition variable, thereby
unblocking the awaiting thread.

Rdar://99977665
2022-11-09 15:58:53 -08:00