]> granicus.if.org Git - clang/commit
[coroutines] Support coroutine-handle returning await-suspend (i.e symmetric control...
authorGor Nishanov <GorNishanov@gmail.com>
Fri, 25 Aug 2017 04:46:54 +0000 (04:46 +0000)
committerGor Nishanov <GorNishanov@gmail.com>
Fri, 25 Aug 2017 04:46:54 +0000 (04:46 +0000)
commit79ceb35ad0a2ac8aea4f605faeff8a2e4564f2b0
treecdb846537ba197d8ef9f921a49a06f392dd877fb
parent2ff6975aa86e1dc2e7322489fdbf8845755ca308
[coroutines] Support coroutine-handle returning await-suspend (i.e symmetric control transfer)

Summary:
If await_suspend returns a coroutine_handle, as in the example below:
```
  coroutine_handle<> await_suspend(coroutine_handle<> h) {
    coro.promise().waiter = h;
    return coro;
  }
```
suspensionExpression processing will resume the coroutine pointed at by that handle.
Related LLVM change rL311751 makes resume calls of this kind `musttail` at any optimization level.

This enables unlimited symmetric control transfer from coroutine to coroutine without blowing up the stack.

Reviewers: GorNishanov

Reviewed By: GorNishanov

Subscribers: rsmith, EricWF, cfe-commits

Differential Revision: https://reviews.llvm.org/D37131

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311762 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/CGCoroutine.cpp
lib/Sema/SemaCoroutine.cpp
test/CodeGenCoroutines/coro-await.cpp