This is an archive of the discontinued LLVM Phabricator instance.

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

Authored by GorNishanov on Aug 24 2017, 9:11 PM.

Details

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.

Diff Detail

Repository
rL LLVM

Event Timeline

GorNishanov accepted this revision.Aug 24 2017, 9:11 PM
GorNishanov created this revision.

LGTM

This revision is now accepted and ready to land.Aug 24 2017, 9:12 PM
This revision was automatically updated to reflect the committed changes.