Skip to content

SIL: Add instructions to represent async suspend points. #34142

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
merged 1 commit into from
Oct 2, 2020

Conversation

jckarter
Copy link
Contributor

@jckarter jckarter commented Oct 1, 2020

get_async_continuation[_addr] begins a suspend operation by accessing the continuation value that can resume
the task, which can then be used in a callback or event handler before executing await_async_continuation to
suspend the task.

@jckarter
Copy link
Contributor Author

jckarter commented Oct 1, 2020

@swift-ci Please test

@swift-ci
Copy link
Contributor

swift-ci commented Oct 1, 2020

Build failed
Swift Test OS X Platform
Git Sha - 9f84623a3f8f209aeec32c977428e10eb05609a2

@swift-ci
Copy link
Contributor

swift-ci commented Oct 1, 2020

Build failed
Swift Test Linux Platform
Git Sha - 9f84623a3f8f209aeec32c977428e10eb05609a2

@jckarter jckarter force-pushed the async-await-sil-instructions branch from 9f84623 to a7076bf Compare October 1, 2020 17:50
@jckarter
Copy link
Contributor Author

jckarter commented Oct 1, 2020

@swift-ci Please test

Copy link
Member

@DougGregor DougGregor left a comment

Choose a reason for hiding this comment

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

Looks great. I'll clean up my PartialAsyncTask handling to use KnownSDKTypes.def once you've landed this.

@@ -18,3 +18,19 @@ public struct PartialAsyncTask {

public func run() { }
}


public struct UnsafeContinuation<T> {
Copy link
Member

Choose a reason for hiding this comment

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

This should be fixed-layout?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure. Since PartialAsyncTask wasn't marked as fixed-layout either, I thought we were leaving annotations off of this for now. Do we build the module with library evolution on?

public func resume(_: T) { }
}

public struct UnsafeThrowingContinuation<T> {
Copy link
Member

Choose a reason for hiding this comment

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

This should be fixed-layout?

@swift-ci
Copy link
Contributor

swift-ci commented Oct 1, 2020

Build failed
Swift Test Linux Platform
Git Sha - a7076bf28ed7bb202c081cfb42c5fdda392f9b1e

@jckarter
Copy link
Contributor Author

jckarter commented Oct 1, 2020

@swift-ci Please test

@swift-ci
Copy link
Contributor

swift-ci commented Oct 1, 2020

Build failed
Swift Test OS X Platform
Git Sha - a7076bf28ed7bb202c081cfb42c5fdda392f9b1e

@swift-ci
Copy link
Contributor

swift-ci commented Oct 1, 2020

Build failed
Swift Test Linux Platform
Git Sha - a7076bf28ed7bb202c081cfb42c5fdda392f9b1e

`get_async_continuation[_addr]` begins a suspend operation by accessing the continuation value that can resume
the task, which can then be used in a callback or event handler before executing `await_async_continuation` to
suspend the task.
@jckarter jckarter force-pushed the async-await-sil-instructions branch from a7076bf to a664a33 Compare October 1, 2020 21:22
@jckarter
Copy link
Contributor Author

jckarter commented Oct 1, 2020

@swift-ci Please test

@swift-ci
Copy link
Contributor

swift-ci commented Oct 1, 2020

Build failed
Swift Test Linux Platform
Git Sha - a664a33

@jckarter
Copy link
Contributor Author

jckarter commented Oct 1, 2020

@swift-ci Please test Linux

@swift-ci
Copy link
Contributor

swift-ci commented Oct 1, 2020

Build failed
Swift Test Linux Platform
Git Sha - a664a33

@jckarter
Copy link
Contributor Author

jckarter commented Oct 2, 2020

@swift-ci Please test Linux

@jckarter jckarter merged commit 95f1bd3 into swiftlang:main Oct 2, 2020
@compnerd
Copy link
Member

compnerd commented Oct 3, 2020

I think that this has caused a regression on the Windows bots: https://ci-external.swift.org/job/oss-swift-windows-x86_64-vs2019/3052/consoleText

compnerd added a commit to compnerd/apple-swift that referenced this pull request Oct 3, 2020
Copy link
Contributor

@rjmccall rjmccall left a comment

Choose a reason for hiding this comment

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

Looking good so far. Don't forget the verifier work.

@@ -7326,6 +7381,52 @@ class UnwindInst
MutableArrayRef<Operand> getAllOperands() { return {}; }
};

/// Suspend execution of an async task until
/// essentially just a funny kind of return).
Copy link
Contributor

Choose a reason for hiding this comment

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

Half-written comment?

@jckarter
Copy link
Contributor Author

jckarter commented Oct 3, 2020

@compnerd You should be able to add REQUIRES: concurrency to the test to disable it if _Concurrency is not currently built on the Windows bots.

@jckarter
Copy link
Contributor Author

jckarter commented Oct 3, 2020

@rjmccall I'm working on the verifier checks in the next commit.

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.

5 participants