Commit Graph

28 Commits

Author SHA1 Message Date
Allan Shortlidge
c02fc4724d Tests: Remove -disable-availability-checking from many Concurrency tests.
Instead, use the `%target-swift-5.1-abi-triple` substitution to compile the tests
for deployment to the minimum OS versions required for use of _Concurrency APIs.
2024-10-18 16:21:51 -07:00
Karoy Lorentey
47956908b7 [Concurrency] SwiftStdlib 5.5 ⟹ SwiftStdlib 5.1 (usages)
The concurrency runtime now deploys back to macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, which corresponds to the 5.1 release of the stdlib.

Adjust macro usages accordingly.
2021-10-28 14:36:36 -07:00
Doug Gregor
3ee09a2298 Switch concurrency runtime tests to "REQUIRES: concurrency_runtime"
Rather than blanket-disabling concurrency tests when we aren't using a
just-built concurrency library, enable them whenever we have a
suitable concurrency runtime, either just-built, in the OS, or via the
back-deployment libraries.
2021-09-13 12:34:20 -07:00
Doug Gregor
eeeea49764 Remove -enable-experimental-concurrency almost everywhere. 2021-07-26 21:24:43 -07:00
Doug Gregor
1e2012d816 Disable availability checking in tests that use concurrency 2021-07-20 12:46:26 -07:00
Alexis Laferrière
3310a55682 [Test] Use the SwiftStdlib 5.5 macro in Concurrency tests 2021-05-06 13:48:49 -07:00
Nate Chandler
ff7c98123a [Test] Disabled several Concurrency tests for back_deployment_runtime.
rdar://76566598
2021-04-13 15:27:41 -07:00
Konrad `ktoso` Malawski
34f8e768b5 spawnDetached to detach, non-suspending group.spawn, spawnUnlessCancelled 2021-04-03 09:53:32 +09:00
Konrad `ktoso` Malawski
6e746304e1 [Concurrency] Update Task and Group APIs based on Review 1 2021-04-03 09:52:03 +09:00
Mike Ash
1173b737aa [Concurrency] Add availability to Concurrency APIs.
This allows programs to target older OSes while using Concurrency behind an availability check. When targeting older OSes, the symbols are weak-linked and the compiler will require the use of Concurrency features to be guarded by an availability check.

rdar://75850003
2021-04-01 10:42:08 -04:00
Karoy Lorentey
24aca4072a [test] Skip concurrency tests during back deployment testing
rdar://76038845
2021-03-30 22:35:38 -07:00
Dario Rexin
14ab1a233f Cleanup after rebase 2021-03-04 09:37:59 -08:00
Dario Rexin
28ce3d97f9 Use async sleep in concurrency tests 2021-03-04 09:37:58 -08:00
Konrad `ktoso` Malawski
b33fae8656 import dispatch in tests, so they can run on linux as well 2021-02-22 13:26:38 +09:00
Konrad `ktoso` Malawski
a55ebff942 [Concurrency] deprecate not implemented Task functions, until they're implemented 2021-02-12 16:33:16 +09:00
Nate Chandler
798f86981f [Test] Replaced runAsyncAndBlock with async @main.
The last outstanding usage is in

    Concurrency/Runtime/checked_continuation.swift
2021-01-28 17:14:55 -08:00
Doug Gregor
3c38ffe0ea [Concurrency] await try -> try await
The `try await` ordering is both easier to read and indicates the order
of operations better, because the suspension point occurs first and
then one can observe a thrown error.
2020-12-23 13:21:59 -08:00
John McCall
7cc63f9a28 Implement a cooperative global executor for single-threaded runtimes.
Currently, the only thing in the system that donates a thread
to run it is swift_runAndBlockThread, but we'll probably need
others.  Nothing in the concurrency runtime should block via a
semaphore in this configuration.

As an outrageous hack, work around the layering problems with
using libdispatch from the concurrency library on non-Darwin
systems by making those systems use the cooperative global
executor.  This is only acceptable as a temporary solution
for landing this change and setting things onto the right
long-term design.
2020-12-10 19:18:53 -05:00
John McCall
1177cde4e3 Use current public Dispatch API to schedule global work.
We expect to iterate on this quite a bit, both publicly
and internally, but this is a fine starting-point.

I've renamed runAsync to runAsyncAndBlock to underline
very clearly what it does and why it's not long for this
world.  I've also had to give it a radically different
implementation in an effort to make it continue to work
given an actor implementation that is no longer just
running all work synchronously.

The major remaining bit of actor-scheduling work is to
make swift_task_enqueue actually do something sensible
based on the executor it's been given; currently it's
expecting a flag that IRGen simply doesn't know to set.
2020-12-10 19:18:53 -05:00
Nate Chandler
84e7ba7081 [Test] Reenabled arm64e concurrency tests. 2020-12-04 18:11:05 -08:00
Doug Gregor
6eb6dd6015 [Concurrency] Update tests for Linux 2020-12-01 10:48:16 -08:00
Doug Gregor
cfe2ebd0c3 [Concurrency] Try harder to enable Concurrency tests on Linux 2020-11-30 17:13:54 -08:00
Doug Gregor
3347f8d4b8 [Concurrency] Generalize futures tests 2020-11-30 10:14:30 -08:00
Doug Gregor
307959e733 [IRGen] Don't mark calls to swift_task_alloc as 'readnone'.
Doing so causes later passes to coalesce swift_task_alloc calls.
2020-11-19 23:26:30 -08:00
Doug Gregor
93d3eb6fb9 [Concurrency] Limit futures test to x86_64 for now.
We have not yet implemented ptrauth support for the async calling
convention, so this test is crashing on arm64e. Limit it to x86_64
until that comes online.

Fixes rdar://71592154.
2020-11-19 23:26:30 -08:00
Doug Gregor
894528062d [Concurrency] Implement Task.Handle.get() in terms of an async runtime call.
Switch the contract between the runtime operation `swift_future_task_wait`
and Task.Handle.get() pver to an asynchronous call, so that the
compiler will set up the resumption frame for us. This allows us to
correctly wait on futures.

Update our "basic" future test to perform both normal returns and
throwing returns from a future, either having to wait on the queue or
coming by afterward.
2020-11-18 22:02:14 -08:00
Doug Gregor
95edef70a4 [Concurrency] Add an async call into our async task for basic futures test.
Extend the basic futures test to include a call to an async function so
that we exercise coroutine splitting.
2020-11-17 10:04:26 -08:00
Doug Gregor
a1284d062c [Concurrency] Stop runDetached from actually printing/running the task.
Rather than immediately running the task synchronously within
runDetached, return the handle to the newly-created task. Add a method
task.Handle.run() to execute the task. This is just a temporary hack
that should not persist in the API, but it lets us launch tasks on a
particular Dispatch queue:

```swift
extension DispatchQueue {
  func async<R>(execute: @escaping () async -> R) -> Task.Handle<R> {
    let handle = Task.runDetached(operation: execute)

    // Run the task
    _ = { self.async { handle.run() } }()

    return handle
  }
}
```

One can pass asynchronous work to DispatchQueue.async, which will
schedule that work on the dispatch queue and return a handle. Another
asynchronous task can then read the result.

Yay for rdar://71125519.
2020-11-17 10:04:26 -08:00