Commit Graph

231 Commits

Author SHA1 Message Date
Konrad `ktoso` Malawski
9438cf6b2e [Distributed] Func metadata operations and implement executeDistributedTarget entry (#40605)
* [Distributed] Implement func metadata and executeDistributedTarget

dont expose new entrypoints

able to get all the way to calling _execute

* [Distributed] reimplement distributed get type info impls

* [Distributed] comment out distributed_actor_remoteCall for now

* [Distributed] disable test on linux for now
2022-01-09 23:55:06 +09:00
Mike Ash
0977920217 [Concurrency] Add tracing for major operations in the concurrency runtime.
Each trace point is declared as a function in the new `Tracing.h` header. These functions are called from the appropriate places in the concurrency runtime.

On Darwin, an implementation of these functions is provided which uses the `os/signpost.h` API to emit signpost events/intervals.

When the signpost API is not available, no-op stub implementations are provided. Implementations for other OSes can be provided by providing implementations of the trace functions for that OS.

rdar://81858487
2022-01-07 11:35:40 -05:00
Saleem Abdulrasool
d30e196c94 Concurrency: avoid unnecessary dependency on LLVMSupport
We do not have the `llvm/Config/config.h` header available in the forked
LLVMSupport library in our standard library packaging.  This removes
that dependency by using the standard macro `_POSIX_THREADS` to detect
if we should use pthreads.
2021-12-27 20:34:52 -08:00
Pavel Yaskevich
774622823c [Concurrency] Throwing continuation type should be typed as SwiftError 2021-12-22 15:00:49 -08:00
Konrad `ktoso` Malawski
a0693c4649 Merge pull request #40675 from xedin/fix-invalid-base-for-accessor-ref
[Distributed] Runtime: Fix retrieval of async pointer from incorrect …
2021-12-22 16:24:56 +09:00
Pavel Yaskevich
302b241625 [Distributed] Runtime: Fix retrieval of async pointer from incorrect base
`accessor` represents a record as a whole, which means that async pointer
to the entry point is located at `Function`.
2021-12-21 16:59:43 -08:00
John McCall
5ce55f84a9 Rip out the concept of an "override job" from default actors.
This has been dead since before the first release.  We need something
like it, but we should probably do it on a clean foundation rather than
building on what's already there.

I've left the barest foundation for "messages" that can be dropped in
the queue but aren't real jobs.

I've left the barest skeleton for "messages" rather than
2021-12-20 18:04:19 -05:00
Pavel Yaskevich
111ceb189a [Distributed] IRGen: Adjust distributed method accessor to store result into a provided buffer
Instead of trying to return result from distributed thunk directly,
modify accessor to store result into the caller-provided buffer.
Doing so helps us avoid boxing the result into `Any`.
2021-12-17 10:52:56 -08:00
Pavel Yaskevich
ed97120d7c [Distributed] Runtime: Implement _executeDistributedTarget
The implementation is as follows:

- Looks up distributed accessor by the given target name
- Extracts information required to setup async context from
  async function pointer stored in accessor record
- Allocates context and calls accessor
2021-12-17 10:52:56 -08:00
Pavel Yaskevich
5af5501437 [Distributed] Runtime: Prototype executeDistributedTarget function 2021-12-17 10:52:56 -08:00
Alastair Houghton
2d335062e2 [Runtime] Don't use threading related APIs when building single threaded.
Mostly this consists of #if-ing out code that we don't need when running
single threaded.

rdar://84393438
2021-11-30 16:18:26 +00:00
Saleem Abdulrasool
306662fd29 Concurrency: fix UB in DefaultActor initialization
This fixes a latent UB instance in the `DefaultActor` implementation
that has haunted the Windows target.  The shared constructor for the
type caused an errant typo that happened to compile which introduced
UB but happened to work for the non-Windows cases.  This happened to
work for the other targets as `swift::atomic` had a `std::atomic` at
on most configurations, and the C delegate for the Actor initializer
happened to overlap and initialize the memory properly.  The Windows
case used an inline pointer width value but would be attempted to be
initialized as a `std::atomic`.  Relying on the overlap is unsafe to
assume, and we should use the type's own constructor which delegates
appropriately.
2021-11-19 10:34:41 -08:00
John McCall
84623ceac4 Teach default actors to execute jobs in priority order.
rdar://76473589
2021-11-18 00:32:58 -05:00
Kavon Farvardin
006e2b446b Replace destoryDistributedActor builtin with destroyDefaultActor
Currently, they both end up doing the exact same thing, so there's
no need for both.
2021-10-21 19:41:31 -07:00
John McCall
a76b304f00 Allow building a concurrent libSwiftConcurrency without libdispatch
The goal here is not to eventually implement a concurrent thread
pool ourselves.  We're just making it easier for integrators who
have their own pool and don't want to use Dispatch to build the
Swift concurrency runtime.  Just hook the right functions and
you should be fine.

The necessary functions to hook are:
- swift_task_enqueueGlobal
- swift_task_enqueueGlobalAfterDelay

The following functions *would* be necessary to hook:
- swift_task_enqueueMainExecutor
- swift_task_asyncMainDrainQueue (only if you have an async main?)
However, this configuration does not currently properly support
the main executor, and so `@MainActor` should be avoided for now.

rdar://83513751
2021-10-01 02:15:03 -04:00
Ben Langmuir
0e507f2f24 Revert "Allow building a concurrent libSwiftConcurrency without libdispatch" 2021-09-28 10:08:46 -07:00
John McCall
1df455bc14 Allow building a concurrent libSwiftConcurrency without libdispatch
The goal here is not to eventually implement a concurrent thread
pool ourselves.  We're just making it easier for integrators who
have their own pool and don't want to use Dispatch to build the
Swift concurrency runtime.  Just hook the right functions and
you should be fine.

The necessary functions to hook are:
- swift_task_enqueueGlobal
- swift_task_enqueueGlobalAfterDelay

The following functions *would* be necessary to hook:
- swift_task_enqueueMainExecutor
- swift_task_asyncMainDrainQueue (only if you have an async main?)
However, this configuration does not currently properly support
the main executor, and so `@MainActor` should be avoided for now.

rdar://83513751
2021-09-28 02:14:26 -04:00
Doug Gregor
aad7ad00ee Make sure we set configuration in back-deployed concurrency libraries. 2021-09-22 21:24:25 -07:00
Doug Gregor
4c9fb2899f Avoid including "llvm/Config/config.h" in the concurrency back-deploy library
We only build for one flavor of platforms anyway, and have generally avoided
these macros.
2021-09-22 21:17:44 -07:00
Wei Wang
3cc89bf1ed Fix a typo
Just reading the source and happens to encounter it.
2021-09-09 12:09:15 +09:00
Mike Ash
a80a19b1e1 [Concurrency] Propagate Darwin vouchers across async tasks.
Darwin OSes support vouchers, which are key/value sets that can be adopted on a thread to influence its execution, or sent to another process. APIs like Dispatch propagate vouchers to worker threads when running async code. This change makes Swift Concurrency do the same.

The change consists of a few different parts:

1. A set of shims (in VoucherShims.h) which provides declarations for the necessary calls when they're not available from the SDK, and stub implementations for non-Darwin platforms.
2. One of Job's reserved fields is now used to store the voucher associated with a job.
3. Jobs grab the current thread's voucher when they're created.
4. A VoucherManager class manages adoption of vouchers when running a Job, and replacing vouchers in suspended tasks.
5. A VoucherManager instance is maintained in ExecutionTrackingInfo, and is updated as necessary throughout a Job/Task's lifecycle.

rdar://76080222
2021-09-02 17:45:28 -04:00
Mike Ash
d5c0469f3e [Concurrency] Replace SWIFT_TASK_PRINTF_DEBUG with a SWIFT_TASK_DEBUG_LOG macro.
This macro takes the string and parameters directly, and is conditionally defined to either call fprintf or ignore its arguments. This makes the call sites a little more pleasant (no #if scattered about) and ensures every log includes the thread ID and a newline automatically.
2021-08-25 10:47:36 -04:00
Konrad `ktoso` Malawski
bf37ba6014 [Distributed] Don't duplicate hasUserDefinedInit entry, less guards 2021-08-12 19:35:01 +09:00
Konrad `ktoso` Malawski
829a5d6895 [Distributed] Review followup and cleanups 2021-08-12 14:09:03 +09:00
Konrad `ktoso` Malawski
9dcd6e43f3 [Distributed] implement more deinit tests 2021-08-12 14:09:03 +09:00
Konrad `ktoso` Malawski
a99e935050 [Distributed] implemented storing transport in resolve 2021-08-12 14:09:02 +09:00
Konrad `ktoso` Malawski
aaf81371ef [Distributed] work in progress SIL actorReady call 2021-08-12 14:09:02 +09:00
Konrad `ktoso` Malawski
7e0a3eba13 [Distributed] Implementing calling transport in resolve and assigning id/transp 2021-08-12 14:08:58 +09:00
Kavon Farvardin
d4c71943bd [distributed] working on runtime allocation function 2021-08-12 14:05:31 +09:00
Doug Gregor
84d488c9bc Ignore task priorities in the actor runtime.
The actor runtime has some known issues with deadlock when an actor has
to give up its thread because it's running lower-priority work. To
avoid deadlocks here, disable all of the logic that tries to give up
higher-priority threads when only lower-priority work is available, or
to escalate work, effectively making the actor runtime ignore
priorities internally.

Fixes rdar://79378762.
2021-07-30 23:27:17 -07:00
Konrad `ktoso` Malawski
73797800b4 [Distributed] introduce static resolve func, and fix static isolation on dist actors (#38530) 2021-07-22 08:00:54 +09:00
John McCall
48b8780e58 Merge pull request #38386 from rjmccall/track-task-is-running
Track whether a task is actively running
2021-07-15 16:22:44 -04:00
Konrad `ktoso` Malawski
716a0255c0 [Distributed] Move to ActorIdentity protocol (#38362) 2021-07-15 21:13:55 +09:00
John McCall
264e4ace12 Clear the active task immediately when suspending. 2021-07-14 20:24:01 -04:00
John McCall
bd451f9f08 Remove the hooking for swift_task_getCurrent().
This is very performance-sensitive and unreasonable to change.
2021-07-14 20:24:01 -04:00
John McCall
3aa04db87b Track whether a task is actively running.
Tracking this as a single bit is actually largely uninteresting
to the runtime.  To handle priority escalation properly, we really
need to track this at a finer grain of detail: recording that the
task is running on a specific thread, enqueued on a specific actor,
or so on.  But starting by tracking a single bit is important for
two reasons:

- First, it's more realistic about the performance overheads of
  tasks: we're going to be doing this tracking eventually, and
  the cost of that tracking will be dominated by the atomic
  access, so doing that access now sets the baseline about right.

- Second, it ensures that we've actually got runtime involvement
  in all the right places to do this tracking.

A propos of the latter: there was no runtime involvement with
awaiting a continuation, which is a point at which the task
potentially transitions from running to suspended.  We must do
the tracking as part of this transition, rather than recognizing
in the run-loops that a task is still active and treating it as
having suspended, because the latter point potentially races with
the resumption of the task.  To do this, I've had to introduce
a runtime function, swift_continuation_await, to do this awaiting
rather than inlining the atomic operation on the continuation.

As part of doing this work, I've also fixed a bug where we failed
to load-acquire in swift_task_escalate before walking the task
status records to invoke escalation actions.

I've also fixed several places where the handling of task statuses
may have accidentally allowed the task to revert to uncancelled.
2021-07-14 20:24:01 -04:00
Mike Ash
190d3fd22e [Concurrency] Use pthread_specific for thread-local storage on Darwin.
The pthread_specific APIs are better than C++ thread_local storage on Darwin since we can use Swift's reserved pthread keys there.

rdar://79504652
2021-06-29 16:56:59 -04: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
Saleem Abdulrasool
d09d4b960b Concurrency: add Windows support to SWIFT_TASK_PRINTF_DEBUG
`pthread_self` is not portable to all platforms.  Introduce a
`_swift_get_current_thread_id` to abstract over accessing the current
thread ID.  On Windows, the thread ID and thread handle are two separate
entities, unlike POSIX threads which treats them the same.
2021-06-05 14:01:02 -07:00
Konrad `ktoso` Malawski
6008b32789 [Distributed] initial distributed support, fixed availability (#37650)
* [Distributed] Initial distributed checking

* [Distributed] initial types shapes and conform to DistributedActor

* [Distributed] Require Codable params and return types

* [Distributed] initial synthesis of fields and constructors

* [Distributed] Field and initializer synthesis

* [Distributed] Codable requirement on distributed funcs; also handle <T: Codable>

* [Distributed] handle generic type params which are Codable in dist func

[Distributed] conformsToProtocol after all

* [Distributed] Implement remote flag on actors

* Implement remote flag on actors

* add test

* actor initializer that sets remote flag

[Distributed] conformances getting there

* [Distributed] dont require async throws; cleanup compile tests

* [Distributed] do not synthesize default implicit init, only our special ones

* [Distributed] properly synth inits and properties; mark actorTransport as _distributedActorIndependent

Also:

- do not synthesize default init() initializer for dist actor

* [Distributed] init(transport:) designated and typechecking

* [Distributed] dist actor initializers MUST delegate to local-init

* [Distributed] check if any ctors in delegation call init(transport:)

* [Distributed] check init(transport:) delegation through many inits; ban invoking init(resolve:using:) explicitly

* [Distributed] disable IRGen test for now

* [Distributed] Rebase cleanups

* [Concurrent] transport and address are concurrent value

* [Distributed] introduce -enable-experimental-distributed flag

* rebase adjustments again

* rebase again...

* [Distributed] distributed functions are implicitly async+throws outside the actor

* [Distributed] implicitly throwing and async distributed funcs

* remove printlns

* add more checks to implicit function test

* [Distributed] resolve initializer now marks the isRemote actor flag

* [Distributed] distributedActor_destroy invoked instead, rather than before normal

* [Distributed] Generate distributed thunk for actors

* [distributed] typechecking for _remote_ functions existing, add tests for remote funcs

* adding one XFAIL'ed task & actor lifetime test

The `executor_deinit1` test fails 100% of the time
(from what I've seen) so I thought we could track
and see when/if someone happens to fix this bug.

Also, added extra coverage for #36298 via `executor_deinit2`

* Fix a memory issue with actors in the runtime system, by @phausler

* add new test that now passes because of patch by @phausler

See previous commit in this PR.
Test is based on one from rdar://74281361

* fix all tests that require the _remote_ function stubs

* Do not infer @actorIndependent onto `let` decls

* REVERT_ME: remove some tests that hacky workarounds will fail

* another flaky test, help build toolchain

* [Distributed] experimental distributed implies experimental concurrency

* [Distributed] Allow distributed function that are not marked async or throws

* [Distributed] make attrs SIMPLE to get serialization generated

* [Distributed] ActorAddress must be Hashable

* [Distributed] Implement transport.actorReady call in local init

* cleanup after rebase

* [Distributed] add availability attributes to all distributed actor code

* cleanup - this fixed some things

* fixing up

* fixing up

* [Distributed] introduce new Distributed module

* [Distributed] diagnose when missing 'import _Distributed'

* [Distributed] make all tests import the module

* more docs on address

* [Distributed] fixup merge issues

* cleanup: remove unnecessary code for now SIMPLE attribute

* fix: fix getActorIsolationOfContext

* [Distributed] cmake: depend on _concurrency module

* fixing tests...

* Revert "another flaky test, help build toolchain"

This reverts commit 83ae6654dd.

* remove xfail

* clenup some IR and SIL tests

* cleanup

* [Distributed] fix cmake test and ScanDependencies/can_import_with_map.swift

* [Distributed] fix flags/build tests

* cleanup: use isDistributed wherever possible

* [Distributed] don't import Dispatch in tests

* dont link distributed in stdlib unittest

* trying always append distributed module

* cleanups

* [Distributed] move all tests to Distributed/ directory

* [lit] try to fix lit test discovery

* [Distributed] update tests after diagnostics for implicit async changed

* [Distributed] Disable remote func tests on Windows for now

* Review cleanups

* [Distributed] fix typo, fixes Concurrency/actor_isolation_objc.swift

* [Distributed] attributes are DistributedOnly (only)

* cleanup

* [Distributed] cleanup: rely on DistributedOnly for guarding the keyword

* Update include/swift/AST/ActorIsolation.h

Co-authored-by: Doug Gregor <dgregor@apple.com>

* introduce isAnyThunk, minor cleanup

* wip

* [Distributed] move some type checking to TypeCheckDistributed.cpp

* [TypeCheckAttr] remove extra debug info

* [Distributed/AutoDiff] fix SILDeclRef creation which caused AutoDiff issue

* cleanups

* [lit] remove json import from lit test suite, not needed after all

* [Distributed] distributed functions only in DistributedActor protocols

* [Distributed] fix flag overlap & build setting

* [Distributed] Simplify noteIsolatedActorMember to not take bool distributed param

* [Distributed] make __isRemote not public

* [Distributed] Fix availability and remove actor class tests

* [actorIndependent] do not apply actorIndependent implicitly to values where it would be illegal to apply

* [Distributed] disable tests until issue fixed

Co-authored-by: Dario Rexin <drexin@apple.com>
Co-authored-by: Kavon Farvardin <kfarvardin@apple.com>
Co-authored-by: Doug Gregor <dgregor@apple.com>
2021-05-28 07:22:03 +09:00
Konrad `ktoso` Malawski
0c75bd2a39 Revert Initial distributed, some issues to be fixed first (#37556)
* Revert "[Distributed] disable tests until issue fixed"

This reverts commit 0a04278920.

* Revert "[Distributed] Initial `distributed` actors and functions and new module (#37109)"

This reverts commit 814ede0cf3.
2021-05-21 19:28:48 +09:00
Konrad `ktoso` Malawski
814ede0cf3 [Distributed] Initial distributed actors and functions and new module (#37109)
* [Distributed] Initial distributed checking

* [Distributed] initial types shapes and conform to DistributedActor

* [Distributed] Require Codable params and return types

* [Distributed] initial synthesis of fields and constructors

* [Distributed] Field and initializer synthesis

* [Distributed] Codable requirement on distributed funcs; also handle <T: Codable>

* [Distributed] handle generic type params which are Codable in dist func

[Distributed] conformsToProtocol after all

* [Distributed] Implement remote flag on actors

* Implement remote flag on actors

* add test

* actor initializer that sets remote flag

[Distributed] conformances getting there

* [Distributed] dont require async throws; cleanup compile tests

* [Distributed] do not synthesize default implicit init, only our special ones

* [Distributed] properly synth inits and properties; mark actorTransport as _distributedActorIndependent

Also:

- do not synthesize default init() initializer for dist actor

* [Distributed] init(transport:) designated and typechecking

* [Distributed] dist actor initializers MUST delegate to local-init

* [Distributed] check if any ctors in delegation call init(transport:)

* [Distributed] check init(transport:) delegation through many inits; ban invoking init(resolve:using:) explicitly

* [Distributed] disable IRGen test for now

* [Distributed] Rebase cleanups

* [Concurrent] transport and address are concurrent value

* [Distributed] introduce -enable-experimental-distributed flag

* rebase adjustments again

* rebase again...

* [Distributed] distributed functions are implicitly async+throws outside the actor

* [Distributed] implicitly throwing and async distributed funcs

* remove printlns

* add more checks to implicit function test

* [Distributed] resolve initializer now marks the isRemote actor flag

* [Distributed] distributedActor_destroy invoked instead, rather than before normal

* [Distributed] Generate distributed thunk for actors

* [distributed] typechecking for _remote_ functions existing, add tests for remote funcs

* adding one XFAIL'ed task & actor lifetime test

The `executor_deinit1` test fails 100% of the time
(from what I've seen) so I thought we could track
and see when/if someone happens to fix this bug.

Also, added extra coverage for #36298 via `executor_deinit2`

* Fix a memory issue with actors in the runtime system, by @phausler

* add new test that now passes because of patch by @phausler

See previous commit in this PR.
Test is based on one from rdar://74281361

* fix all tests that require the _remote_ function stubs

* Do not infer @actorIndependent onto `let` decls

* REVERT_ME: remove some tests that hacky workarounds will fail

* another flaky test, help build toolchain

* [Distributed] experimental distributed implies experimental concurrency

* [Distributed] Allow distributed function that are not marked async or throws

* [Distributed] make attrs SIMPLE to get serialization generated

* [Distributed] ActorAddress must be Hashable

* [Distributed] Implement transport.actorReady call in local init

* cleanup after rebase

* [Distributed] add availability attributes to all distributed actor code

* cleanup - this fixed some things

* fixing up

* fixing up

* [Distributed] introduce new Distributed module

* [Distributed] diagnose when missing 'import _Distributed'

* [Distributed] make all tests import the module

* more docs on address

* [Distributed] fixup merge issues

* cleanup: remove unnecessary code for now SIMPLE attribute

* fix: fix getActorIsolationOfContext

* [Distributed] cmake: depend on _concurrency module

* fixing tests...

* Revert "another flaky test, help build toolchain"

This reverts commit 83ae6654dd.

* remove xfail

* clenup some IR and SIL tests

* cleanup

* [Distributed] fix cmake test and ScanDependencies/can_import_with_map.swift

* [Distributed] fix flags/build tests

* cleanup: use isDistributed wherever possible

* [Distributed] don't import Dispatch in tests

* dont link distributed in stdlib unittest

* trying always append distributed module

* cleanups

* [Distributed] move all tests to Distributed/ directory

* [lit] try to fix lit test discovery

* [Distributed] update tests after diagnostics for implicit async changed

* [Distributed] Disable remote func tests on Windows for now

* Review cleanups

* [Distributed] fix typo, fixes Concurrency/actor_isolation_objc.swift

* [Distributed] attributes are DistributedOnly (only)

* cleanup

* [Distributed] cleanup: rely on DistributedOnly for guarding the keyword

* Update include/swift/AST/ActorIsolation.h

Co-authored-by: Doug Gregor <dgregor@apple.com>

* introduce isAnyThunk, minor cleanup

* wip

* [Distributed] move some type checking to TypeCheckDistributed.cpp

* [TypeCheckAttr] remove extra debug info

* [Distributed/AutoDiff] fix SILDeclRef creation which caused AutoDiff issue

* cleanups

* [lit] remove json import from lit test suite, not needed after all

* [Distributed] distributed functions only in DistributedActor protocols

* [Distributed] fix flag overlap & build setting

* [Distributed] Simplify noteIsolatedActorMember to not take bool distributed param

* [Distributed] make __isRemote not public

Co-authored-by: Dario Rexin <drexin@apple.com>
Co-authored-by: Kavon Farvardin <kfarvardin@apple.com>
Co-authored-by: Doug Gregor <dgregor@apple.com>
2021-05-21 09:12:29 +09:00
Varun Gandhi
35b9d01cb3 [Runtime] Remove FIXMEs and hacks for tail calls.
Reverts hack from 9b4f7d62cd.
2021-05-17 12:46:58 -07:00
Arnold Schwaighofer
9b4f7d62cd Make sure we tail call optimize a call in concurrency runtime's switch_task_impl.
Without this hack the call will leave a stack frame around (not tail
call optimized) and blow the stack if we call switch_task often enough.

Ideally, clang would emit this call as `musttail` but currently it does
not.

rdar://76652421
2021-05-15 08:07:55 -07:00
3405691582
eb945c81f2 [concurrency] Provide missing header file. (#37004)
HAVE_PTHREAD_H is supplied in this config file.

The `__has_include` pattern is discouraged, but there is no other way of
conditioning on `pthread_np.h`, which is required for `pthread_main_np`
on OpenBSD. Therefore, use it, but call it out in a comment.
2021-05-13 09:13:36 -07:00
John McCall
186c53000d Introduce basic support for custom executors.
- Introduce an UnownedSerialExecutor type into the concurrency library.
- Create a SerialExecutor protocol which allows an executor type to
  change how it executes jobs.
- Add an unownedExecutor requirement to the Actor protocol.
- Change the ABI for ExecutorRef so that it stores a SerialExecutor
  witness table pointer in the implementation field.  This effectively
  makes ExecutorRef an `unowned(unsafe) SerialExecutor`, except that
  default actors are represented without a witness table pointer (just
  a bit-pattern).
- Synthesize the unownedExecutor method for default actors (i.e. actors
  that don't provide an unownedExecutor property).
- Make synthesized unownedExecutor properties `final`, and give them
  a semantics attribute specifying that they're for default actors.
- Split `Builtin.buildSerialExecutorRef` into a few more precise
  builtins.  We're not using the main-actor one yet, though.

Pitch thread:
  https://forums.swift.org/t/support-custom-executors-in-swift-concurrency/44425
2021-04-30 03:11:56 -04:00
Fred Riss
28a23e5b41 Fix Windows build
```
S:\jenkins\workspace\swift-PR-windows\swift\stdlib\public\Concurrency\Actor.cpp(1612,22): error: expected unqualified-id
              : std::max(oldPriority, job->getPriority());
                     ^
C:\Program Files (x86)\Windows Kits\10\\Include\10.0.18362.0\shared\minwindef.h(193,29): note: expanded from macro max
#define max(a,b)            (((a) > (b)) ? (a) : (b))
                            ^
1 error generated.
```
2021-04-29 17:09:44 -07:00
Fred Riss
8f1a73cf09 [Concurrency] Use a stable TSD on Darwin to store the current Task
This gives low-level tools (e.g. backtracers) an ABI way to access
the current task.
2021-04-29 09:55:43 -07:00
Mike Ash
b144a71d06 [Concurrency] Push an autorelease pool around job runs.
This ensures that job code that calls out to ObjC code will see a consistent autorelease environment.

rdar://75329282
2021-04-28 16:19:03 -04:00
Doug Gregor
fba8ccadfc [Concurrency] Perform userInitiated adjustment after determining priority.
Based on feedback, perform the adjustment from userInteractive to
userInitiated all the time, and rely on `qos_class_self` whenever we
don't have a task.
2021-04-26 15:15:29 -07:00