Skip to content

Conversation

@gottesmm
Copy link
Contributor

We previously were not "unsending" inout sending parameters after sending them
so they could not be used again in the caller and could not be forwarded into
other 'inout sending' parameters. While looking at the code I
realized it was pretty obtuse/confusing so I cleaned up the logic and fixed a
few other issues in the process.

Now we follow the following pattern in the non-isolation crossing case:

  1. We first require the callee operand.
  2. We then merge/require all of the non-explicitly sent parameters.
  3. We then through all of the parameters and require/send all of the sending parameters.
  4. At the end of processing, we unsend all of the sending parameters that were
    'inout sending' parameters.

In the case of isolation crossing applies we:

  1. Require all parameters that are not explicitly marked as sending and then
    send them all at once. We are really just saving a little work by not merging
    them into one large region and then requiring/sending that region once.

  2. Then for each sending parameter, we require/send them one by one interleaving
    the requires/sends. This ensures that if a value is passed to different
    explicitly sending parameters, we get an error.

  3. Then once we have finished processing results, we perform an undo send on all
    of the 'inout sending' params.

rdar://154440896

…nout sending.

We previously were not "unsending" inout sending parameters after sending them
so they could not be used again in the caller and could not be forwarded into
other 'inout sending' parameters. While looking at the code I
realized it was pretty obtuse/confusing so I cleaned up the logic and fixed a
few other issues in the process.

Now we follow the following pattern in the non-isolation crossing case:

1. We first require the callee operand.
2. We then merge/require all of the non-explicitly sent parameters.
3. We then through all of the parameters and require/send all of the sending parameters.
4. At the end of processing, we unsend all of the sending parameters that were
'inout sending' parameters.

In the case of isolation crossing applies we:

1. Require all parameters that are not explicitly marked as sending and then
send them all at once. We are really just saving a little work by not merging
them into one large region and then requiring/sending that region once.

2. Then for each sending parameter, we require/send them one by one interleaving
the requires/sends. This ensures that if a value is passed to different
explicitly sending parameters, we get an error.

3. Then once we have finished processing results, we perform an undo send on all
of the 'inout sending' params.

rdar://154440896
@gottesmm
Copy link
Contributor Author

@swift-ci smoke test

@gottesmm gottesmm merged commit 8686d3f into swiftlang:main Oct 11, 2025
3 checks passed
@gottesmm gottesmm deleted the pr-280fbe6eca8e73a6caec46dd571aa9afe8bf8b93 branch October 11, 2025 06:00
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.

1 participant