Skip to content

[concurrency] Fix a few issues with @execution(caller)/@execution(concurrent). #80374

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

gottesmm
Copy link
Contributor

Specifically:

  1. I made it so that thunks from caller -> concurrent properly ignore the
    isolated parameter of the thunk when calling the concurrent function.

rdar://148112362

  1. I made it so that thunks from concurrent -> caller properly create a
    Optional.none and pass that into the caller function.

rdar://148112384

  1. I made it so that in cases where we are assigning an @sendable caller to a
    non-sendable caller variable, we allow for the conversion as long as the
    parameters/results are sendable as well.

rdar://148112532

  1. I made it so that when we generate a thunk from @execution(caller) ->
    @GlobalActor, we mangle in @GlobalActor into the thunk.

rdar://148112569

  1. I discovered that due to the way we handle function conversion expr/decl ref
    expr, we were emitted two thunks when we assigned a global @caller function to a
    local @caller variable. The result is that we would first cast from @caller ->
    @Concurrent and then back to @caller. The result of this would be that the
    @caller function would always be called on the global queue.

rdar://148112646

I also added a bunch of basic tests as well that showed that this behavior was
broken.


I did these in the same PR since I was basically iterating on writing simple code and found these issues. I have found some more issues that I am going to keep iterating/fixing.

This just makes it easier to work with these types in the debugger. Just slicing
off commits from a larger patch.
@gottesmm
Copy link
Contributor Author

@swift-ci smoke test

1 similar comment
@gottesmm
Copy link
Contributor Author

@swift-ci smoke test

@gottesmm gottesmm force-pushed the pr-ee297e6b432cd07483ec86444ffd6a8b5334c203 branch from 9cf8672 to e88ec99 Compare March 28, 2025 23:31
@gottesmm
Copy link
Contributor Author

@swift-ci smoke test

@gottesmm gottesmm force-pushed the pr-ee297e6b432cd07483ec86444ffd6a8b5334c203 branch from e88ec99 to 4733133 Compare March 28, 2025 23:52
@gottesmm
Copy link
Contributor Author

@swift-ci smoke test

…current).

Specifically:

1. I made it so that thunks from caller -> concurrent properly ignore the
isolated parameter of the thunk when calling the concurrent function.

rdar://148112362

2. I made it so that thunks from concurrent -> caller properly create a
Optional<any Actor>.none and pass that into the caller function.

rdar://148112384

3. I made it so that in cases where we are assigning an @sendable caller to a
non-sendable caller variable, we allow for the conversion as long as the
parameters/results are sendable as well.

rdar://148112532

4. I made it so that when we generate a thunk from @execution(caller) ->
@GlobalActor, we mangle in @GlobalActor into the thunk.

rdar://148112569

5. I discovered that due to the way we handle function conversion expr/decl ref
expr, we were emitted two thunks when we assigned a global @caller function to a
local @caller variable. The result is that we would first cast from @caller ->
@Concurrent and then back to @caller. The result of this would be that the
@caller function would always be called on the global queue.

rdar://148112646

I also added a bunch of basic tests as well that showed that this behavior was
broken.
@gottesmm gottesmm force-pushed the pr-ee297e6b432cd07483ec86444ffd6a8b5334c203 branch from 4733133 to f245389 Compare March 31, 2025 03:12
@gottesmm
Copy link
Contributor Author

@swift-ci smoke test

@gottesmm gottesmm merged commit 918756f into swiftlang:main Mar 31, 2025
3 checks passed
@gottesmm gottesmm deleted the pr-ee297e6b432cd07483ec86444ffd6a8b5334c203 branch March 31, 2025 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants