Commit Graph

11 Commits

Author SHA1 Message Date
Michael Gottesman
b1750bad1a [concurrency] Implement swift_task_runOnMainActor.
This routine takes a synchronous non-throwing main actor isolated closure
without a result. If we are dynamically on the main actor, we just run the
closure synchronously. Otherwise, we run a new task on the main actor and call
the closure on that.

This builds on top of the previous commit by using
swift_task_isCurrentExecutorWithFlags in the implementation of this function.

To backwards deploy this function on Darwin, I used some tricks from libdispatch
to validate that we are on the main queue.
2024-10-17 11:17:38 -07:00
Kavon Farvardin
bfa909526b add objc coverage to actor_init_abi test 2022-06-30 18:07:51 -07:00
Kavon Farvardin
73bc4b64f2 add test to catch regressions in ABI stability of actor inits
it should not matter whether an initializer is delegating or not when
importing a library. this test helps make sure that stays true.
2022-06-27 18:59:09 -07:00
Joe Groff
391a3bd42d Add test that exercises still overriding ObjC async methods as completion handlers 2021-05-10 12:53:32 -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
1586ca83d9 add execution test for ObjC-imported effectful properties 2021-04-02 08:33:22 -07:00
Slava Pestov
7ccc41a7b7 SIL: Preliminary support for 'apply [noasync]' calls
Refactor SILGen's ApplyOptions into an OptionSet, add a
DoesNotAwait flag to go with DoesNotThrow, and sink it
all down into SILInstruction.h.

Then, replace the isNonThrowing() flag in ApplyInst and
BeginApplyInst with getApplyOptions(), and plumb it
through to TryApplyInst as well.

Set the flag when SILGen emits a sync call to a reasync
function.

When set, this disables the SIL verifier check against
calling async functions from sync functions.

Finally, this allows us to add end-to-end tests for
rdar://problem/71098795.
2021-03-04 22:41:46 -05:00
Slava Pestov
72e1f02ae2 IRGen: Fix async dispatch thunk emission with loadable return value
Fixes <rdar://problem/74246091>.
2021-02-12 14:06:07 -05:00
Slava Pestov
adc92e95d2 IRGen: Fix preservation of error result in async dispatch thunks 2021-01-30 00:05:57 -05:00
Slava Pestov
0768d1eb1a IRGen: Fix resilient witness tables and vtables to correctly reference async methods
Resilient witness tables and resilient class vtables are built from
descriptors. Make sure we reference the AsyncFunctionPointer of a
method implementation, and not the implementation itself, if the
method is async.

Part of rdar://problem/73625623.
2021-01-28 21:55:47 -05:00
Joe Groff
7ed46b136a Add a runtime test for ObjC interop. 2020-12-09 16:59:56 -08:00