Commit Graph

6 Commits

Author SHA1 Message Date
Michael Gottesman
82b0ec3de0 [silgen] Make sure that thunks that convert to/from nonisolated(nonsending) handle hopping correctly.
Specifically:

1. When we convert a function to nonisolated(nonsending), we need to
make sure that in the thunk we hop upon return since nonisolated(nonsending)
functions are assumed to preserve the caller's isolation.

2. When we convert a function from nonisolated(nonsending), we need to
make sure that in the thunk we hop onto the actor that we are passing in as the
isolated parameter of the nonisolated(nonsending) function. This ensures that
the nonisolated(nonsending) function can assume that it is already on its
isolated parameter's actor at function entry.

rdar://155905383
2025-07-17 10:55:59 -07:00
Pavel Yaskevich
c68a17b8c4 [Concurrency] Don't infer nonisolated(nonsending) on synchronous witnesses
If the requirement is `nonisolated(nonsending)` but witness is
synchronous, prevent actor isolation inference from requirements
because this isolation only applies to asynchronous declarations
at the moment.

Resolves: rdar://153680826
(cherry picked from commit a964282275)
2025-06-23 13:58:07 -07:00
Michael Gottesman
27cf33676f [silgen] Place the correct isolation on protocol witness thunks.
We were using the isolation from the witness not from the requirement which we
are supposed to do. The witness thunk thunks the isolation from the requirement
to the witness so from an ABI perspective it should have the interface implied
by the requirement's isolation since that is what callers of the witness method
will expect.

rdar://151394209
(cherry picked from commit 39a013f807)
2025-05-19 10:33:57 -07:00
Pavel Yaskevich
3896f8fd77 [AST] Remove ExecutionAttribute experimental feature
SE-0461 has been accepted and `@concurrent` and `nonisolated(nonsending)`
can be make generally available now.
2025-04-16 13:20:12 -07:00
Pavel Yaskevich
06f880e65c [AST/ASTGen/Sema/Serialization] Remove @execution attribute
Complete the transition from `@execution` to `@concurrent` and `nonisolated(nonsending)`
2025-04-16 13:18:52 -07:00
Michael Gottesman
769673d002 [concurrency] Implement protocol witness thunking in SILGen for @execution(caller)/@execution(concurrent).
This involved cleaning up and generalizing the work from
f245389bb3. I followed the same approach: hide the
implicit parameter while we run things through translateArgument and friends and
then put it back in manually.

As an additional benefit, I think I found a good place to put FunctionIsolation
onto lowered AnyFunctionTypes that will not cause cycles in the evaluator since
it is done in TypeLowering.

rdar://148785846
(cherry picked from commit 04b845cc97)
2025-04-10 15:38:17 -07:00