Commit Graph

543 Commits

Author SHA1 Message Date
swift-ci
2074057785 Merge pull request #37415 from DougGregor/remove-asynchandler 2021-05-13 19:47:46 -07:00
Doug Gregor
2b9ca315fe [Concurrency] Remove asyncHandler attribute.
The `asyncHandler` attribute turned out to be the wrong solution
to the problem of creating a sync->async bridge. Remove it.
2021-05-13 17:01:39 -07:00
Joe Groff
8e1dcb481f Merge pull request #37393 from jckarter/disable-flaky-objc-async-test
Disable flaky test/Concurrency/Runtime/objc_async.swift test.
2021-05-13 16:13:02 -07:00
Pavel Yaskevich
3823966e01 Merge pull request #37395 from xedin/rdar-75849035
[Concurrency] Actor cannot conform to global actor isolated protocol
2021-05-13 13:44:07 -07:00
Arnold Schwaighofer
f82edf72c7 Mark test async_stream as executable_test
It fails on non_executable bots.

rdar://77963528
2021-05-13 06:26:10 -07:00
Pavel Yaskevich
ecfff76552 [Concurrency] Actor cannot conform to global actor isolated protocol
Attempting to conform an actor to a global actor isolated protocol
creates a clash in isolation when members are accessed so, let's
detect and diagnose that.

Resolves: rdar://75849035
2021-05-12 16:00:25 -07:00
Joe Groff
74736c75ba Disable flaky test/Concurrency/Runtime/objc_async.swift test.
We need to introduce some proper synchronization between the @main task and the ObjC
completion handler to make this reliably deterministic. rdar://77934626
2021-05-12 15:24:40 -07:00
Philippe Hausler
4886bd56e4 [Concurrency] AsyncStream and AsyncThrowingStream
* Rework YieldingContinuation to service values in a buffered fashion

* Fix word size calculation for locks

* Handle terminal states and finished/failed storage

* Wrap yielding continuation into a more featureful type for better ergonomics

* Hope springs eternal, maybe windows works with this?

* Prevent value overflows at .max limits

* Add a cancellation handler

* Fix series tests missing continuation parameters

* Fix series tests for mutable itertaors

* Rename to a more general name for Series's inner continuation type

* Whitespace fixes and add more commentary about public functions on Series

* Restore YieldingContinuation for now with deprecations to favor Series

* Ensure onCancel is invoked in deinit phases, and eliminate a potential for double cancellation

* Make sure ThrowingSeries has the same nonmutating setter for onCancel as Series

* Add a swath of more unit tests that exersize cancellation behavior as well as throwing behaviors

* Remove work-around for async testing

* Fixup do/catch range to properly handle ThrowingSeries test

* Address naming consistency of resume result function

* Adopt the async main test setup

* More migration of tests to new async mechanisms

* Handle the double finish/throw case

* Ensure the dependency on Dispatch is built for the series tests (due to semaphore usage)

* Add import-libdispatch to run command for Series tests

* Use non-combine based timeout intervals (portable to linux) for dispatch semaphore

* Rename Series -> AsyncStream and resume functions to just yield, and correct a missing default Element.self value

* Fix missing naming change issue for yielding an error on AsyncThrowingStream

* Remove argument label of buffering from tests

* Extract buffer and throwing variants into their own file

* Slightly refactor for only needing to store the producer instead of producer and cancel

* Rename onCancel to onTermination

* Convert handler access into a function pair

* Add finished states to the termination handler event pipeline and a disambiguation enum to identify finish versus cancel

* Ensure all termination happens before event propigation (and outside of the locks) and warn against requirements for locking on terminate and enqueue

* Modified to use Deque to back the storage and move the storage to inner types; overall perf went from 200kE/sec to over 1ME/sec

* Update stdlib/public/Concurrency/AsyncStream.swift

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

* Update stdlib/public/Concurrency/AsyncThrowingStream.swift

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

* Update stdlib/public/Concurrency/AsyncStream.swift

Co-authored-by: Joseph Heck <heckj@mac.com>

* Update stdlib/public/Concurrency/AsyncThrowingStream.swift

Co-authored-by: Joseph Heck <heckj@mac.com>

* Update stdlib/public/Concurrency/AsyncThrowingStream.swift

Co-authored-by: Joseph Heck <heckj@mac.com>

* Update stdlib/public/Concurrency/AsyncThrowingStream.swift

Co-authored-by: Joseph Heck <heckj@mac.com>

* Update stdlib/public/Concurrency/AsyncStream.swift

Co-authored-by: Joseph Heck <heckj@mac.com>

* Update stdlib/public/Concurrency/AsyncThrowingStream.swift

Co-authored-by: Joseph Heck <heckj@mac.com>

* Remove local cruft for overlay disabling

* Remove local cruft for Dispatch overlay work

* Remove potential ABI impact for adding Deque

Co-authored-by: Doug Gregor <dgregor@apple.com>
Co-authored-by: Joseph Heck <heckj@mac.com>
2021-05-11 21:41:33 -07:00
Arnold Schwaighofer
bd010c3998 Merge pull request #37369 from aschwaighofer/availability_macro_concurrency_tests
Use availability macro insteada of macOS 9999 in Concurrency tests
2021-05-11 14:01:15 -07:00
Arnold Schwaighofer
753fae3fd1 Disable async_task_async_let_child_cancel.swift test
It sometimes fails on bots.

rdar://77671328
2021-05-11 10:49:17 -07:00
Arnold Schwaighofer
887902eabd Use availability macro insteada of macOS 9999 in Concurrency tests 2021-05-11 10:40:45 -07:00
Joe Groff
63613a9a83 Merge pull request #37348 from jckarter/runtime-test-async-objc-method-completion-handler-override
Add test that exercises still overriding ObjC async methods as completion handlers
2021-05-11 09:50:16 -07:00
Konrad `ktoso` Malawski
6cbb792f92 [TaskLocals] Propagate task-locals through async{} 2021-05-11 11:06:17 +09:00
Konrad `ktoso` Malawski
82e91b7785 [TaskLocals] Enable sync functions to bind task-locals; Keep Storage in TLS 2021-05-11 11:06:16 +09:00
Joe Groff
391a3bd42d Add test that exercises still overriding ObjC async methods as completion handlers 2021-05-10 12:53:32 -07:00
Alexis Laferrière
7487c12d05 Merge pull request #37269 from xymus/test-macro
[Concurrency] Define and use the SwiftStdlib 5.5 availability macro in tests
2021-05-10 10:46:53 -07:00
Arnold Schwaighofer
970034441a Disable executor_deinit1.swift test in optimized mode
It fails on some bots.

rdar://77658743
2021-05-07 09:17:00 -07:00
Doug Gregor
49edef8dd4 Merge pull request #37304 from DougGregor/revert-nonisolated
[Concurrency] Revert 'nonisolated let' change.
2021-05-07 07:49:03 -07:00
Doug Gregor
06dc77ddf3 Revert "[Concurrency] Resyntax 'async let' as 'spawn let'."
This reverts commit 41f42fabbf.
2021-05-06 22:18:36 -07:00
Doug Gregor
052cc7d022 [Concurrency] Revert 'nonisolated let' change.
The change made to SE-0306 to require 'nonisolated let' is undercutting
the effectiveness of the model. Revert while we work on a better
solution.
2021-05-06 17:30:11 -07:00
Alexis Laferrière
3310a55682 [Test] Use the SwiftStdlib 5.5 macro in Concurrency tests 2021-05-06 13:48:49 -07:00
Holly Borla
6eb133b627 Merge pull request #37263 from hborla/async-closure-diagnostics
[Concurrency] Improve diagnostics for missing `await`
2021-05-05 16:43:45 -07:00
Holly Borla
b6a3434851 [Concurrency] Emit a tailored note for a missing await if the call is implicitly
asynchronous due to actor isolation.
2021-05-05 11:35:40 -07:00
Holly Borla
8e78c8b35c [CSApply] Propagate 'async' from contextual types to closures, unless the closure
is an argument to a 'reasync' function.
2021-05-05 11:35:40 -07:00
Arnold Schwaighofer
34b532add1 Merge pull request #37274 from aschwaighofer/fix_some_concurrency_tests_for_os_stdlib
Fix some concurrency tests not to run on os stdlib bots
2021-05-05 10:37:18 -07:00
Arnold Schwaighofer
1fc81fe726 Fix some concurrency tests not to run on os stdlib bots
rdar://77564014
2021-05-05 10:35:42 -07:00
Pavel Yaskevich
f5e672e985 Merge pull request #37216 from xedin/rdar-70610141
[Diagnostics] Improve diagnostics when passing `async` to a sync parameter
2021-05-05 10:10:05 -07:00
Pavel Yaskevich
0cca70b916 Merge pull request #37260 from xedin/rdar-76475495
[Sema] Suppress concurrency related diagnostics for invalid AST nodes
2021-05-05 10:09:51 -07:00
Arnold Schwaighofer
b327bc985e Disable Concurrency/Runtime/checked_continuation.swift on windows
It seems to fail sometimes.
2021-05-05 09:58:27 -07:00
Joe Groff
38497aa6b2 Merge pull request #37226 from jckarter/objc-async-bridge-block-captures
SILGen: Copy the block before detaching a task for async methods called from ObjC.
2021-05-04 15:48:00 -07:00
Pavel Yaskevich
0e9c33e47f [Sema] Suppress concurrency related diagnostics for invalid AST nodes
Expressions that failed type-check can't be correctly analyzed by
effects checker due to missing type and overload choice information.

Resolves: rdar://76475495
2021-05-04 14:25:07 -07:00
Pavel Yaskevich
c842773450 [Diagnostics] Re-phrase note about inferred async effect from an operation in a closure body 2021-05-04 10:09:03 -07:00
Joe Groff
ecc46a809e Sleep to give new test completion handler a chance to run 2021-05-04 09:25:08 -07:00
Mishal Shah
1263da107b Merge pull request #37223 from aschwaighofer/xfail_concurrency_throwing_windows
XFAIL: test/Concurrency/throwing.swift on windows
2021-05-03 20:26:43 -07:00
adrian-prantl
43c5d8954b Merge pull request #37155 from adrian-prantl/75905336-1
Allow functions marked @LLDBDebuggerFunction to bypass actor isolatio…
2021-05-03 18:51:00 -07:00
Joe Groff
acac14e757 SILGen: Copy the block before detaching a task for async methods called from ObjC.
The block needs to survive long enough for the task to get scheduled. Fixes rdar://76871310.
2021-05-03 15:31:22 -07:00
Kavon Farvardin
e17e09c294 Enable effectful properties (SE-310) by default.
1. Removes gating on -enable-experimental-concurrency.
2. Updates eff. prop tests to remove experimental flag,
   and also adjusts some tests slightly to avoid things
   that are still behind that flag.
2021-05-03 14:10:44 -07:00
Arnold Schwaighofer
2240f7ffbc XFAIL: test/Concurrency/throwing.swift on windows 2021-05-03 13:51:45 -07:00
Pavel Yaskevich
886a8ab6b7 [Diagnostics] Improve diagnostics when passing async to a sync parameter
If `async` effect has been inferred from the body of the closure,
let's find out the first occurrence of `async` node and point it out
to make it clear why closure is `async`.

Resolves: rdar://70610141
2021-05-03 11:08:36 -07:00
Arnold Schwaighofer
513774ea3a Merge pull request #37179 from aschwaighofer/fix_async_throwing_unnaturally_direct
IRGen: Don't ignore the error parameter in some async functions
2021-05-03 07:26:16 -07:00
swift-ci
a6915e7bfe Merge pull request #37197 from ktoso/wip-group-dont-require-sendble-yet 2021-05-02 21:37:20 -07:00
Konrad `ktoso` Malawski
1cd7180382 [Concurrency] don't require Sendable (yet) on groups and locals 2021-05-03 10:52:06 +09:00
John McCall
20741e059b Disable this test on Windows; it seems to not progress. (#37200)
I assume there's a common underlying problem for this and a lot of
other concurrency tests that are disabled on Windows.
2021-05-01 10:12:11 -07:00
Arnold Schwaighofer
0edbca04bf IRGen: Don't ignore the error parameter in some async functions
Calls that emit the result to memory follow a different path that we
missed to update with error handling code.

rdar://76599021
2021-04-30 12:22:50 -07:00
John McCall
cc2863c136 Merge pull request #36878 from rjmccall/custom-executors
Introduce basic support for custom executors
2021-04-30 13:54:02 -04:00
swift-ci
e152c14c0a Merge pull request #37162 from DougGregor/spawn-let 2021-04-30 02:19:16 -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
Doug Gregor
41f42fabbf [Concurrency] Resyntax 'async let' as 'spawn let'.
This helps track the proposal.
2021-04-29 23:28:16 -07:00
swift-ci
bf6c673fd3 Merge pull request #36959 from ktoso/wip-task-locals-revisions 2021-04-29 20:50:01 -07:00
Adrian Prantl
5fe0c03d5f Allow functions marked @LLDBDebuggerFunction to bypass actor isolation checks
In order to allow LLDB to evaluate expressions inside an actor without spawining
async functions and potentially continue all threads, this relaxes the actor
isolation checks in @LLDBDebuggerFunction functions to allow a synchronous call
into an extension method.

rdar://75905336
2021-04-29 20:13:30 -07:00