@@ -61,13 +61,18 @@ template <worker_context Context>
6161[[nodiscard]]
6262constexpr auto final_suspend (frame_type<Context> *frame) noexcept -> coro<> {
6363
64+ // Validate final state
65+ LF_ASSUME (frame->steals == 0 );
66+ LF_ASSUME (frame->joins == k_u16_max);
67+ LF_ASSUME (frame->exception_bit == 0 );
68+
6469 defer _ = [frame] noexcept -> void {
6570 frame->handle ().destroy ();
6671 };
6772
6873 switch (not_null (frame)->kind ) {
6974 case category::call:
70- return not_null (frame->parent )->handle ();
75+ return not_null (frame->parent . frame )->handle ();
7176 case category::root:
7277 // TODO: root handling
7378 return std::noop_coroutine ();
@@ -79,7 +84,7 @@ constexpr auto final_suspend(frame_type<Context> *frame) noexcept -> coro<> {
7984
8085 Context *context = not_null (thread_context<Context>);
8186
82- frame_type<Context> *parent = not_null (frame->parent );
87+ frame_type<Context> *parent = not_null (frame->parent . frame );
8388
8489 if (frame_handle last_pushed = context->pop ()) {
8590 // No-one stole continuation, we are the exclusive owner of parent, so we
@@ -186,7 +191,7 @@ struct awaitable : std::suspend_always {
186191 // TODO: handle cancellation
187192
188193 // Propagate parent->child relationships
189- self.child ->parent = &parent.promise ().frame ;
194+ self.child ->parent . frame = &parent.promise ().frame ;
190195 self.child ->cancel = parent.promise ().frame .cancel ;
191196 self.child ->stack_ckpt = not_null (thread_context<Context>)->alloc ().checkpoint ();
192197 self.child ->kind = Cat;
0 commit comments