Commit Graph

1607 Commits

Author SHA1 Message Date
Allan Shortlidge
3aca6b6ceb Concurrency: Remove superfluous $BuiltinCreateTaskGroupWithFlags guards. 2024-07-02 22:26:55 -07:00
Allan Shortlidge
ee8a1152b2 Concurrency: Promote BuiltinCreateTask feature to baseline. 2024-07-02 22:26:55 -07:00
Allan Shortlidge
7e181d17e5 Concurrency: Promote BuiltinCreateAsyncDiscardingTaskInGroupWithExecutor feature to baseline. 2024-07-02 22:26:55 -07:00
Allan Shortlidge
e5744f04d6 Concurrency: Promote BuiltinCreateAsyncDiscardingTaskInGroup feature to baseline. 2024-07-02 22:26:55 -07:00
Allan Shortlidge
a4d58671ba Concurrency: Promote BuiltinCreateAsyncTaskInGroupWithExecutor feature to baseline. 2024-07-02 22:26:54 -07:00
Allan Shortlidge
f2519650ae Concurrency: Promote BuiltinBuildComplexEqualityExecutor feature to baseline. 2024-07-02 22:26:54 -07:00
Allan Shortlidge
ba630c0da5 Concurrency: Promote BuiltinBuildTaskExecutorRef feature to baseline. 2024-07-02 22:26:54 -07:00
Konrad `ktoso` Malawski
deb81bcf07 Discard changes to stdlib/public/Concurrency/Executor.swift (#74859) 2024-07-01 06:57:43 -07:00
Konrad `ktoso` Malawski
b9369bf0b7 [Concurrency] Fix default actor isolation issue in face of TaskExecutor preference (#74658)
* [Concurrency] Fix task excutor handling of default actor isolation

The task executor API did not properly account for taking the default
actor locking into account when running code on it, we just took the job
and ran it without checking with the serial executor at all, which
resulted in potential concurrent executions inside the actor --
violating actor isolation.

Here we change the TaskExecutor enqueue API to accept the "target"
serial executor, which in practice will be either generic or a specific
default actor, and coordinate with it when we perform a
runSynchronously.

The SE proposal needs to be amended to showcase this new API, however
without this change we are introducing races so we must do this before
the API is stable.

* Remove _swift_task_enqueueOnTaskExecutor as we don't use it anymore

* no need for the new protocol requirement

* remove the enqueue(_ job: UnownedJob, isolatedTo unownedSerialExecutor: UnownedSerialExecutor)

Thankfully we dont need it after all

* Don't add swift_defaultActor_enqueue_withTaskExecutor and centralize the task executor getting to enqueue()

* move around extern definitions
2024-07-01 16:42:27 +09:00
Rokhini Prabhu
1f466c2312 Merge pull request #70603 from swiftlang/rokhinip/clear-scheduler-private-fields-executor
Clear out the SchedulerPrivate fields before enqueueing the task
2024-06-27 09:52:31 -07:00
Konrad `ktoso` Malawski
0c65fe8f42 Remove TaskGroup backDeployed annotation typo that included * (#74756)
Fix typo on a single task group backDeployed annotation.
2024-06-26 18:17:43 -07:00
Konrad `ktoso` Malawski
8bc53736e4 Merge pull request #73568 from ktoso/wip-fix-last-_unsafeInheritExecutor-usage
[Concurrency] Remove last usages of @_unsafeInheritExecutor
2024-06-26 22:01:28 +09:00
Kuba (Brecka) Mracek
9caf750e7f Merge pull request #74536 from kubamracek/embedded-windows1
[embedded] Start building embedded stdlib on Windows
2024-06-24 12:22:24 -07:00
Konrad `ktoso` Malawski
0160fc367a [Concurrency] adopt #isolation in last remaining APIs 2024-06-24 11:44:44 +09:00
Konrad `ktoso` Malawski
58c5a76836 [Concurrency] TaskGroup.with... APIs using #isolation
move tests to existing actor_withCancellationHandler.swift file
2024-06-24 11:44:44 +09:00
Konrad `ktoso` Malawski
2546f63cb5 [Concurrency] Fix _unsafeInheritExecutor usage in withTaskCancellationHandler 2024-06-24 11:44:43 +09:00
Kuba Mracek
6eeef12849 [embedded] Add a embedded-libraries CMake target to simplify the test dependencies 2024-06-23 13:08:01 -07:00
Kuba Mracek
187f772d09 [embedded] Start building embedded stdlib on Windows 2024-06-21 21:32:52 -07:00
Michael Gottesman
d28eef2d62 [sending] Convert the TaskGroup APIs 2024-06-21 06:11:17 -07:00
Michael Gottesman
b541e0299e [concurrency] Deprecate some source compatibility APIs in swift 5 and obsolete in swift 6.
These APIs remained to preserve source compatibility during bringup. We do not
want them used in swift 6 mode... so deprecate in swift 5 and obsolete in swift
6.
2024-06-21 02:24:03 -07:00
Michael Gottesman
4697546e09 [sending] Mark Task.init,detached, and friends as sending methods instead of __owned @Sendable so we can capture non-isolated values. 2024-06-21 02:24:03 -07:00
Konrad `ktoso` Malawski
a43abe6a90 [Concurrency] Remove OPTNONE workaround for old clang version
This reverts c07aa9c425 which was done to
avoid a crash in optimnized caused by this PR:
https://github.com/apple/swift/pull/41088

Since this was almost 2 years ago, we probably don't have this issue
anymore as far as I can see other resolved issues, so try to remove the
workaround.

Resolves rdar://88711954
2024-06-20 20:03:33 +09:00
Holly Borla
4bec599931 Merge pull request #74543 from hborla/promote-isolated-any
[Features] Promote `IsolatedAny` and its alias to a language feature.
2024-06-19 10:32:30 -07:00
Holly Borla
966269d31a [Features] Promote IsolatedAny and its alias to a language feature.
The proposal is accepted and implemented for Swift 6.0.
2024-06-18 22:09:16 -07:00
Michael Gottesman
05124286c3 Merge pull request #74149 from gottesmm/pr-2808d3e61fa0b5b0dea4b8e7650b69cede701624
[concurrency] Mark the global _emptyDequeStorage as nonisolated(unsafe).
2024-06-18 16:42:38 -07:00
Slava Pestov
8582828e7a Merge pull request #74445 from slavapestov/fix-failure-type-witness
Concurrency: Fix default type witness for AsyncSequence.Failure
2024-06-17 17:09:06 -04:00
Konrad `ktoso` Malawski
8a2e755b9a GlobalActor documentation typos fixup (#74467)
Co-authored-by: Holly Borla <hborla@apple.com>
2024-06-16 22:28:54 -07:00
Slava Pestov
61d00cacd6 Concurrency: Fix default type witness for AsyncSequence.Failure
Setting this to Self.AsyncIterator.Failure doesn't work because
we replace it with its reduced type Self.Failure, and then if
you run a binary compiled against an older version of the stdlib
that does not declare the Failure associated type, we hit
infinite recursion while instantiating the witness table and
trying to populate the default type witness.

Instead, let's set the default to `any Error`. Associated type
inference is already smart enough to infer the type witness from
the AsyncIterator's Failure type; we don't need to rely on the
default mechanism for that.

Fixes rdar://129605725.
2024-06-14 22:43:49 -04:00
Konrad `ktoso` Malawski
2ec717b115 [Concurrency] TaskExecutor ownership fixes (#74000) 2024-06-14 22:56:33 +09:00
Konrad `ktoso` Malawski
0cf67e4cdf Merge pull request #74319 from ktoso/wip-global-custom-exec-docs 2024-06-14 14:48:36 +09:00
Doug Gregor
c5a77fcce5 Add a proper TaskGroup.Iterator.next(isolation:)
Implement this function to pass the isolation through to the task group's
`next(isolation:)`. Fixes rdar://129690995.
2024-06-12 15:57:40 -07:00
Konrad `ktoso` Malawski
fe66c47b8a [docs] Provide more documentation on custom executors with global actors
It could be confusing to adopters who were led to believe by the types
that they should "just" implement the sharedUnownedExecutor property,
but insead they have to implement the unownedExecutor on the specific
actor type.

Adding documentation clarify this as well as a simple test that
exercises this explicitly; We seem to have much coverage of main actor,
but not so much of custom executor global actors.
2024-06-12 12:28:55 +09:00
Konrad `ktoso` Malawski
f245ecf45c [TaskGroup] Fix typo in code snippet 2024-06-10 18:29:38 +09:00
Konrad `ktoso` Malawski
0135623d9a [docs] fix typo in type name in code snippet 2024-06-10 17:21:47 +09:00
Konrad `ktoso` Malawski
d8cba034b3 [docs] remove swift style code highlighting on non-swift snippet 2024-06-10 17:20:57 +09:00
Konrad `ktoso` Malawski
cd0b3f0d4d [docs] Remove line in Task docs that is an error in Swift 6 mode 2024-06-10 17:19:57 +09:00
Alex Lorenz
c8b5344d3e Merge pull request #72014 from compnerd/android
utils: support building android SDKs on Windows
2024-06-07 12:37:00 -07:00
Michael Gottesman
db66a207e1 Merge pull request #74151 from gottesmm/pr-89c1f2ab73ad928c312b9bdddb9e2c5cb550439c
[concurrency] Update withUnsafe{,Throwing}Continuation to have a sending result.
2024-06-05 20:06:09 -07:00
Alex Lorenz
5aa63fc93e Merge pull request #72634 from hyp/eng/android/ndk-overlay
[android] add an Android NDK Swift overlay
2024-06-05 19:35:13 -07:00
Michael Gottesman
5db3b70c65 [concurrency] Update withUnsafe{,Throwing}Continuation to have a sending result.
rdar://129299180
2024-06-05 12:50:59 -07:00
Michael Gottesman
7e8daa80cd [concurrency] Mark the global _emptyDequeStorage as nonisolated(unsafe).
We just use it as a way to initialize values. We will always just read from it
and copy from it.
2024-06-05 12:03:57 -07:00
Konrad `ktoso` Malawski
4fc0f3ab61 Merge pull request #73634 from ktoso/wip-document-exexecutors-apidoc 2024-06-05 06:27:46 +09:00
Konrad `ktoso` Malawski
89adc8293c [Docs] Minor rewording of Task docs, easier to read 2024-06-04 15:42:04 +09:00
Konrad `ktoso` Malawski
2182dce8b7 [Concurrency] Document custom executors in API docs a bit
Include review feedback and show how to customize a single actor by
passing an executor through initializer
2024-06-04 15:42:02 +09:00
Konrad `ktoso` Malawski
083fdaa0de Merge pull request #73998 from nickolas-pohilets/mpokhylets/fix-32-build 2024-06-04 13:49:19 +09:00
Konrad `ktoso` Malawski
14b8546392 [Concurrency] Don't add new task locals copy runtime func 2024-06-03 13:55:02 +09:00
Michael Gottesman
ce1dd43395 [sending] Change CheckedContinuation/AsyncThrowingStream.Continuation APIs to use sending parameters and results.
Specifically:

1. CheckedContinuation.resume now takes a sending parameter.
2. Async{Throwing,}Stream.yield takes a sending parameter.
3. withCheckedContinuation returns a transferring parameter.

Importantly due to the previous changes around mangling, this is a mangling
neutral change.

rdar://120420024
2024-06-01 23:25:16 -07:00
Konrad `ktoso` Malawski
0c44645832 [Concurrency] Implement defensive copying in task groups, rather than crashing (#73978) 2024-05-31 11:27:03 -07:00
Mykola Pokhylets
987b641a7c Updated HeaderFooterLayout to correctly handle empty Header or Footer 2024-05-30 21:56:28 +02:00
Mykola Pokhylets
a891b8f0fb Move isDistributedRemoteActor outside #if 2024-05-30 21:55:58 +02:00