Skip to content

IRGen: get/await_async_continuation support #34829

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

aschwaighofer
Copy link
Contributor

rdar://71124933

@aschwaighofer
Copy link
Contributor Author

@swift-ci please test

@aschwaighofer
Copy link
Contributor Author

@swift-ci Please smoke test

// SwiftError *errResult;
// union {
// IndirectResult *result;
// DirectResult *result;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the difference between IndirectResult and DirectResult?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing, really.

Sometimes, we store direct results directly in a data structure.

In such a case I would have written:

struct {
   //   AsyncContext *resumeCtxt;
   //   void *awaitSynchronization;
   //   SwiftError *errResult;
   //   union {
   //     IndirectResult *result;
   //     DirectResult result;

I wanted to point out that the storage for both cases is the same.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, so for a word-sized result, we store it directly in the context? That makes sense.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No we don't currently.

With the sentence:

Sometimes, we store direct results directly in a data structure.

I wanted to say: In other places such as the context passed to async functions (not the continuation context mentioned here) we store direct results in place and indirect results by address:
https://github.com/apple/swift/blob/main/lib/IRGen/GenCall.cpp#L161
https://github.com/apple/swift/blob/main/lib/IRGen/GenCall.cpp#L190

The notation:

  //   union {
  //     IndirectResult *result;
  //     DirectResult *result;

is meant to convey that both direct and indirect results are stored the same (as addresses to memory that stores the result).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On net, I think just saying Result* would probably be clearer.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aschwaighofer
Copy link
Contributor Author

@swift-ci Please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - cca2425

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - cca2425

@aschwaighofer
Copy link
Contributor Author

@swift-ci please test

@aschwaighofer aschwaighofer marked this pull request as ready for review November 30, 2020 14:42
@aschwaighofer
Copy link
Contributor Author

@swift-ci Please smoke test

@aschwaighofer aschwaighofer merged commit b0be562 into swiftlang:main Nov 30, 2020
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.

4 participants