[Coroutines] Store the index for final suspend point if there is unwind coro end
Closing https://github.com/llvm/llvm-project/issues/57339 The root cause for this issue is an pre-mature optimization to eliminate the index for the final suspend point since we feel like we can judge if a coroutine is suspended at the final suspend by if resume_fn_addr is null. However this is not true if the coroutine exists via an exception in promise.unhandled_exception(). According to [dcl.fct.def.coroutine]p14: > If the evaluation of the expression promise.unhandled_exception() > exits via an exception, the coroutine is considered suspended at the > final suspend point. But from the perspective of the implementation, we can't set the coro index to the final suspend point directly since it breaks the states. To fix the issue, we block the optimization if we find there is any unwind coro end, which indicates that it is possible that the coroutine exists via an exception from promise.unhandled_exception(). Test Plan: folly
Loading
Please sign in to comment