Commit Graph

15 Commits

Author SHA1 Message Date
Michael Gottesman
cf93476d0b [region-isolation] Require T in assumeIsolated<T> to be Sendable.
I had to change the APIs to always be always emit into client instead of back
deployable since silgen_name seems to interfere with @backDeployment. So I
switched the implementation so that it instead uses an always emit into client
thunk with the in source function name and a usableFromInline function that has
the silgen_name. This ensures that we still appropriately export the same symbol
as we did before, so it is ABI stable.

This was approved as part of se-0414.

rdar://122030520
2024-04-02 13:49:13 -07:00
Allan Shortlidge
65c0ef830e Concurrency: Guard use of withoutActuallyEscaping() in inlinable code.
Since `withoutActuallyEscaping()` has adopted typed throws, it's no longer
visible to older compilers that do not support typed throws. We need to guard
use of the function in inlinable code to make sure the textual interface of
`_Concurrency` remains buildable with older compilers.

Resolves rdar://124352900
2024-03-12 10:34:57 -07:00
Konrad `ktoso` Malawski
70b1c0e43c [Concurrency] Major cleanup of assert/precondition/assume isolated docs (#70800)
Co-authored-by: Alex Martini <amartini@apple.com>
2024-01-10 23:48:32 -08:00
Doug Gregor
0fbbc6ae65 [SE-0392] Back-deploy assertIsolation/assumeIsolation
The assertIsolation/assumeIsolation operations on actors are
back-deployable back to the introduction of concurrency. Do so.

Resolves rdar://111880539
2023-12-14 15:13:46 -08:00
Konrad `ktoso` Malawski
b8780c9d9e [Executors] Move assert/assume APIs onto actors; assumeIsolated() (#64812) 2023-04-04 07:44:43 +09:00
Nate Chandler
68eea8adec [TaskToThread] No unstructured tasks.
In this mode, the following are disabled:

- task creation
- global actors
- MainActor
- custom executors
2022-07-06 11:51:16 -07:00
Jager-yoo
3b8db192a0 [Gardening] fix typo "supercede" -> "supersede" 2022-05-29 03:35:24 +09: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
420e21a287 Fix the other implementation, too. 2021-10-22 08:39:22 -07:00
Doug Gregor
2850b65bd9 Simplify implementation and fix a test 2021-10-22 08:30:50 -07:00
Doug Gregor
5f9721c7fb Ensure that we hop off the main actor after MainActor.run.
Asynchronous functions isolated to global actors hop to the global at
the beginning of the function but do not hop back on return. For
`MainActor.run`, this means that we would not "hop back" off the main
actor after executing the closure, which lead to too much code running
on the main thread. Dropping the "async" ensures that we hop back.
While we my also want the general "hop back" semantics for
asynchronous actor-isolated functions, for now this addresses the
problem with `MainActor.run`.

Fixes rdar://82138050.
2021-10-21 23:26:02 -07:00
Doug Gregor
b2a902796c Force the mangled name of MainActor.run to not include the Sendable constraint.
This API already shipped without the Sendable constraint, and adding the
constraint (while it's fine with the compiler) changed the mangled name of
this API. Use `@_silgen_name` to restore the old existing mangled name so
we don't break the ABI.

Fixes rdar://83644760.
2021-09-29 09:25:22 -07:00
Doug Gregor
4a63884026 Add missing Sendable requirements and a conformance 2021-08-26 10:56:48 -07:00
John McCall
ca62a79079 Use &_dispatch_main_q as the identity of the main actor.
I added Builtin.buildMainActorExecutor before, but because I never
implemented it correctly in IRGen, it's not okay to use it on old
versions, so I had to introduce a new feature only for it.

The shim dispatch queue class in the Concurrency runtime is rather
awful, but I couldn't think of a reasonable alternative without
just entirely hard-coding the witness table in the runtime.
It's not ABI, at least.
2021-06-17 05:04:30 -04:00
Doug Gregor
8a068e0c08 [SE-0316] Introduce the GlobalActor protocol to describe global actors.
Based on the discussion in the first review of the global actors
proposal, introduce a `GlobalActor` protocol that describes types that
can be global actors. Introduce this protocol, make `@globalActor`
types implicitly conform to it, and remove all of the bespoke
validation logic that was used to check the "shared" member.

Addresses rdar://79339591
2021-06-15 06:39:12 -07:00