-
Notifications
You must be signed in to change notification settings - Fork 10.5k
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
Conversation
@swift-ci Please test |
Build failed |
Build failed |
9f84623
to
a7076bf
Compare
@swift-ci Please test |
There was a problem hiding this 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> { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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> { |
There was a problem hiding this comment.
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?
Build failed |
@swift-ci Please test |
Build failed |
Build failed |
`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.
a7076bf
to
a664a33
Compare
@swift-ci Please test |
Build failed |
@swift-ci Please test Linux |
Build failed |
@swift-ci Please test Linux |
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 |
There was a problem hiding this 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). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Half-written comment?
@compnerd You should be able to add |
@rjmccall I'm working on the verifier checks in the next commit. |
get_async_continuation[_addr]
begins a suspend operation by accessing the continuation value that can resumethe task, which can then be used in a callback or event handler before executing
await_async_continuation
tosuspend the task.