[PATCH] D37131: [coroutines] Support coroutine-handle returning await-suspend (i.e symmetric control transfer)

Gor Nishanov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 24 21:11:57 PDT 2017


GorNishanov created this revision.

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 https://reviews.llvm.org/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.


https://reviews.llvm.org/D37131

Files:
  lib/CodeGen/CGCoroutine.cpp
  lib/Sema/SemaCoroutine.cpp
  test/CodeGenCoroutines/coro-await.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37131.112658.patch
Type: text/x-patch
Size: 5185 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170825/fb94b730/attachment-0001.bin>


More information about the cfe-commits mailing list