diff --git a/src/core/lib/promise/detail/join_state.h b/src/core/lib/promise/detail/join_state.h index 7dffa8b255d..d6ce8782bfa 100644 --- a/src/core/lib/promise/detail/join_state.h +++ b/src/core/lib/promise/detail/join_state.h @@ -65,18 +65,10 @@ struct JoinState { } JoinState& operator=(const JoinState& other) = delete; JoinState& operator=(JoinState&& other) = delete; - GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION JoinState(JoinState&& other) noexcept - : ready(other.ready) { - if (ready.is_set(0)) { - Construct(&result0, std::move(other.result0)); - } else { - Construct(&promise0, std::move(other.promise0)); - } - if (ready.is_set(1)) { - Construct(&result1, std::move(other.result1)); - } else { - Construct(&promise1, std::move(other.promise1)); - } + GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION JoinState(JoinState&& other) noexcept { + DCHECK(other.ready.none()); + Construct(&promise0, std::move(other.promise0)); + Construct(&promise1, std::move(other.promise1)); } GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION ~JoinState() { if (ready.is_set(0)) { @@ -180,23 +172,11 @@ struct JoinState { } JoinState& operator=(const JoinState& other) = delete; JoinState& operator=(JoinState&& other) = delete; - GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION JoinState(JoinState&& other) noexcept - : ready(other.ready) { - if (ready.is_set(0)) { - Construct(&result0, std::move(other.result0)); - } else { - Construct(&promise0, std::move(other.promise0)); - } - if (ready.is_set(1)) { - Construct(&result1, std::move(other.result1)); - } else { - Construct(&promise1, std::move(other.promise1)); - } - if (ready.is_set(2)) { - Construct(&result2, std::move(other.result2)); - } else { - Construct(&promise2, std::move(other.promise2)); - } + GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION JoinState(JoinState&& other) noexcept { + DCHECK(other.ready.none()); + Construct(&promise0, std::move(other.promise0)); + Construct(&promise1, std::move(other.promise1)); + Construct(&promise2, std::move(other.promise2)); } GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION ~JoinState() { if (ready.is_set(0)) { @@ -337,28 +317,12 @@ struct JoinState { } JoinState& operator=(const JoinState& other) = delete; JoinState& operator=(JoinState&& other) = delete; - GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION JoinState(JoinState&& other) noexcept - : ready(other.ready) { - if (ready.is_set(0)) { - Construct(&result0, std::move(other.result0)); - } else { - Construct(&promise0, std::move(other.promise0)); - } - if (ready.is_set(1)) { - Construct(&result1, std::move(other.result1)); - } else { - Construct(&promise1, std::move(other.promise1)); - } - if (ready.is_set(2)) { - Construct(&result2, std::move(other.result2)); - } else { - Construct(&promise2, std::move(other.promise2)); - } - if (ready.is_set(3)) { - Construct(&result3, std::move(other.result3)); - } else { - Construct(&promise3, std::move(other.promise3)); - } + GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION JoinState(JoinState&& other) noexcept { + DCHECK(other.ready.none()); + Construct(&promise0, std::move(other.promise0)); + Construct(&promise1, std::move(other.promise1)); + Construct(&promise2, std::move(other.promise2)); + Construct(&promise3, std::move(other.promise3)); } GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION ~JoinState() { if (ready.is_set(0)) { @@ -535,33 +499,13 @@ struct JoinState { } JoinState& operator=(const JoinState& other) = delete; JoinState& operator=(JoinState&& other) = delete; - GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION JoinState(JoinState&& other) noexcept - : ready(other.ready) { - if (ready.is_set(0)) { - Construct(&result0, std::move(other.result0)); - } else { - Construct(&promise0, std::move(other.promise0)); - } - if (ready.is_set(1)) { - Construct(&result1, std::move(other.result1)); - } else { - Construct(&promise1, std::move(other.promise1)); - } - if (ready.is_set(2)) { - Construct(&result2, std::move(other.result2)); - } else { - Construct(&promise2, std::move(other.promise2)); - } - if (ready.is_set(3)) { - Construct(&result3, std::move(other.result3)); - } else { - Construct(&promise3, std::move(other.promise3)); - } - if (ready.is_set(4)) { - Construct(&result4, std::move(other.result4)); - } else { - Construct(&promise4, std::move(other.promise4)); - } + GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION JoinState(JoinState&& other) noexcept { + DCHECK(other.ready.none()); + Construct(&promise0, std::move(other.promise0)); + Construct(&promise1, std::move(other.promise1)); + Construct(&promise2, std::move(other.promise2)); + Construct(&promise3, std::move(other.promise3)); + Construct(&promise4, std::move(other.promise4)); } GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION ~JoinState() { if (ready.is_set(0)) { @@ -774,38 +718,14 @@ struct JoinState { } JoinState& operator=(const JoinState& other) = delete; JoinState& operator=(JoinState&& other) = delete; - GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION JoinState(JoinState&& other) noexcept - : ready(other.ready) { - if (ready.is_set(0)) { - Construct(&result0, std::move(other.result0)); - } else { - Construct(&promise0, std::move(other.promise0)); - } - if (ready.is_set(1)) { - Construct(&result1, std::move(other.result1)); - } else { - Construct(&promise1, std::move(other.promise1)); - } - if (ready.is_set(2)) { - Construct(&result2, std::move(other.result2)); - } else { - Construct(&promise2, std::move(other.promise2)); - } - if (ready.is_set(3)) { - Construct(&result3, std::move(other.result3)); - } else { - Construct(&promise3, std::move(other.promise3)); - } - if (ready.is_set(4)) { - Construct(&result4, std::move(other.result4)); - } else { - Construct(&promise4, std::move(other.promise4)); - } - if (ready.is_set(5)) { - Construct(&result5, std::move(other.result5)); - } else { - Construct(&promise5, std::move(other.promise5)); - } + GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION JoinState(JoinState&& other) noexcept { + DCHECK(other.ready.none()); + Construct(&promise0, std::move(other.promise0)); + Construct(&promise1, std::move(other.promise1)); + Construct(&promise2, std::move(other.promise2)); + Construct(&promise3, std::move(other.promise3)); + Construct(&promise4, std::move(other.promise4)); + Construct(&promise5, std::move(other.promise5)); } GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION ~JoinState() { if (ready.is_set(0)) { @@ -1054,43 +974,15 @@ struct JoinState { } JoinState& operator=(const JoinState& other) = delete; JoinState& operator=(JoinState&& other) = delete; - GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION JoinState(JoinState&& other) noexcept - : ready(other.ready) { - if (ready.is_set(0)) { - Construct(&result0, std::move(other.result0)); - } else { - Construct(&promise0, std::move(other.promise0)); - } - if (ready.is_set(1)) { - Construct(&result1, std::move(other.result1)); - } else { - Construct(&promise1, std::move(other.promise1)); - } - if (ready.is_set(2)) { - Construct(&result2, std::move(other.result2)); - } else { - Construct(&promise2, std::move(other.promise2)); - } - if (ready.is_set(3)) { - Construct(&result3, std::move(other.result3)); - } else { - Construct(&promise3, std::move(other.promise3)); - } - if (ready.is_set(4)) { - Construct(&result4, std::move(other.result4)); - } else { - Construct(&promise4, std::move(other.promise4)); - } - if (ready.is_set(5)) { - Construct(&result5, std::move(other.result5)); - } else { - Construct(&promise5, std::move(other.promise5)); - } - if (ready.is_set(6)) { - Construct(&result6, std::move(other.result6)); - } else { - Construct(&promise6, std::move(other.promise6)); - } + GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION JoinState(JoinState&& other) noexcept { + DCHECK(other.ready.none()); + Construct(&promise0, std::move(other.promise0)); + Construct(&promise1, std::move(other.promise1)); + Construct(&promise2, std::move(other.promise2)); + Construct(&promise3, std::move(other.promise3)); + Construct(&promise4, std::move(other.promise4)); + Construct(&promise5, std::move(other.promise5)); + Construct(&promise6, std::move(other.promise6)); } GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION ~JoinState() { if (ready.is_set(0)) { @@ -1375,48 +1267,16 @@ struct JoinState { } JoinState& operator=(const JoinState& other) = delete; JoinState& operator=(JoinState&& other) = delete; - GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION JoinState(JoinState&& other) noexcept - : ready(other.ready) { - if (ready.is_set(0)) { - Construct(&result0, std::move(other.result0)); - } else { - Construct(&promise0, std::move(other.promise0)); - } - if (ready.is_set(1)) { - Construct(&result1, std::move(other.result1)); - } else { - Construct(&promise1, std::move(other.promise1)); - } - if (ready.is_set(2)) { - Construct(&result2, std::move(other.result2)); - } else { - Construct(&promise2, std::move(other.promise2)); - } - if (ready.is_set(3)) { - Construct(&result3, std::move(other.result3)); - } else { - Construct(&promise3, std::move(other.promise3)); - } - if (ready.is_set(4)) { - Construct(&result4, std::move(other.result4)); - } else { - Construct(&promise4, std::move(other.promise4)); - } - if (ready.is_set(5)) { - Construct(&result5, std::move(other.result5)); - } else { - Construct(&promise5, std::move(other.promise5)); - } - if (ready.is_set(6)) { - Construct(&result6, std::move(other.result6)); - } else { - Construct(&promise6, std::move(other.promise6)); - } - if (ready.is_set(7)) { - Construct(&result7, std::move(other.result7)); - } else { - Construct(&promise7, std::move(other.promise7)); - } + GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION JoinState(JoinState&& other) noexcept { + DCHECK(other.ready.none()); + Construct(&promise0, std::move(other.promise0)); + Construct(&promise1, std::move(other.promise1)); + Construct(&promise2, std::move(other.promise2)); + Construct(&promise3, std::move(other.promise3)); + Construct(&promise4, std::move(other.promise4)); + Construct(&promise5, std::move(other.promise5)); + Construct(&promise6, std::move(other.promise6)); + Construct(&promise7, std::move(other.promise7)); } GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION ~JoinState() { if (ready.is_set(0)) { @@ -1736,53 +1596,17 @@ struct JoinState { } JoinState& operator=(const JoinState& other) = delete; JoinState& operator=(JoinState&& other) = delete; - GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION JoinState(JoinState&& other) noexcept - : ready(other.ready) { - if (ready.is_set(0)) { - Construct(&result0, std::move(other.result0)); - } else { - Construct(&promise0, std::move(other.promise0)); - } - if (ready.is_set(1)) { - Construct(&result1, std::move(other.result1)); - } else { - Construct(&promise1, std::move(other.promise1)); - } - if (ready.is_set(2)) { - Construct(&result2, std::move(other.result2)); - } else { - Construct(&promise2, std::move(other.promise2)); - } - if (ready.is_set(3)) { - Construct(&result3, std::move(other.result3)); - } else { - Construct(&promise3, std::move(other.promise3)); - } - if (ready.is_set(4)) { - Construct(&result4, std::move(other.result4)); - } else { - Construct(&promise4, std::move(other.promise4)); - } - if (ready.is_set(5)) { - Construct(&result5, std::move(other.result5)); - } else { - Construct(&promise5, std::move(other.promise5)); - } - if (ready.is_set(6)) { - Construct(&result6, std::move(other.result6)); - } else { - Construct(&promise6, std::move(other.promise6)); - } - if (ready.is_set(7)) { - Construct(&result7, std::move(other.result7)); - } else { - Construct(&promise7, std::move(other.promise7)); - } - if (ready.is_set(8)) { - Construct(&result8, std::move(other.result8)); - } else { - Construct(&promise8, std::move(other.promise8)); - } + GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION JoinState(JoinState&& other) noexcept { + DCHECK(other.ready.none()); + Construct(&promise0, std::move(other.promise0)); + Construct(&promise1, std::move(other.promise1)); + Construct(&promise2, std::move(other.promise2)); + Construct(&promise3, std::move(other.promise3)); + Construct(&promise4, std::move(other.promise4)); + Construct(&promise5, std::move(other.promise5)); + Construct(&promise6, std::move(other.promise6)); + Construct(&promise7, std::move(other.promise7)); + Construct(&promise8, std::move(other.promise8)); } GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION ~JoinState() { if (ready.is_set(0)) { diff --git a/src/core/lib/promise/detail/seq_state.h b/src/core/lib/promise/detail/seq_state.h index a4dac2445b9..b2b635f98bc 100644 --- a/src/core/lib/promise/detail/seq_state.h +++ b/src/core/lib/promise/detail/seq_state.h @@ -122,23 +122,15 @@ struct SeqState { } GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION SeqState(const SeqState& other) noexcept : state(other.state), whence(other.whence) { - CHECK(state == State::kState0); + DCHECK(state == State::kState0); Construct(&prior.current_promise, other.prior.current_promise); Construct(&prior.next_factory, other.prior.next_factory); } SeqState& operator=(const SeqState& other) = delete; GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION SeqState(SeqState&& other) noexcept : state(other.state), whence(other.whence) { - switch (state) { - case State::kState0: - Construct(&prior.current_promise, - std::move(other.prior.current_promise)); - goto tail0; - case State::kState1: - Construct(¤t_promise, std::move(other.current_promise)); - return; - } - tail0: + DCHECK(state == State::kState0); + Construct(&prior.current_promise, std::move(other.prior.current_promise)); Construct(&prior.next_factory, std::move(other.prior.next_factory)); } GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION SeqState& operator=(SeqState&& other) = @@ -259,31 +251,19 @@ struct SeqState { } GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION SeqState(const SeqState& other) noexcept : state(other.state), whence(other.whence) { - CHECK(state == State::kState0); - Construct(&prior.current_promise, other.prior.current_promise); + DCHECK(state == State::kState0); + Construct(&prior.prior.current_promise, other.prior.prior.current_promise); Construct(&prior.prior.next_factory, other.prior.prior.next_factory); Construct(&prior.next_factory, other.prior.next_factory); } SeqState& operator=(const SeqState& other) = delete; GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION SeqState(SeqState&& other) noexcept : state(other.state), whence(other.whence) { - switch (state) { - case State::kState0: - Construct(&prior.prior.current_promise, - std::move(other.prior.prior.current_promise)); - goto tail0; - case State::kState1: - Construct(&prior.current_promise, - std::move(other.prior.current_promise)); - goto tail1; - case State::kState2: - Construct(¤t_promise, std::move(other.current_promise)); - return; - } - tail0: + DCHECK(state == State::kState0); + Construct(&prior.prior.current_promise, + std::move(other.prior.prior.current_promise)); Construct(&prior.prior.next_factory, std::move(other.prior.prior.next_factory)); - tail1: Construct(&prior.next_factory, std::move(other.prior.next_factory)); } GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION SeqState& operator=(SeqState&& other) = @@ -455,8 +435,9 @@ struct SeqState { } GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION SeqState(const SeqState& other) noexcept : state(other.state), whence(other.whence) { - CHECK(state == State::kState0); - Construct(&prior.current_promise, other.prior.current_promise); + DCHECK(state == State::kState0); + Construct(&prior.prior.prior.current_promise, + other.prior.prior.prior.current_promise); Construct(&prior.prior.prior.next_factory, other.prior.prior.prior.next_factory); Construct(&prior.prior.next_factory, other.prior.prior.next_factory); @@ -465,30 +446,13 @@ struct SeqState { SeqState& operator=(const SeqState& other) = delete; GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION SeqState(SeqState&& other) noexcept : state(other.state), whence(other.whence) { - switch (state) { - case State::kState0: - Construct(&prior.prior.prior.current_promise, - std::move(other.prior.prior.prior.current_promise)); - goto tail0; - case State::kState1: - Construct(&prior.prior.current_promise, - std::move(other.prior.prior.current_promise)); - goto tail1; - case State::kState2: - Construct(&prior.current_promise, - std::move(other.prior.current_promise)); - goto tail2; - case State::kState3: - Construct(¤t_promise, std::move(other.current_promise)); - return; - } - tail0: + DCHECK(state == State::kState0); + Construct(&prior.prior.prior.current_promise, + std::move(other.prior.prior.prior.current_promise)); Construct(&prior.prior.prior.next_factory, std::move(other.prior.prior.prior.next_factory)); - tail1: Construct(&prior.prior.next_factory, std::move(other.prior.prior.next_factory)); - tail2: Construct(&prior.next_factory, std::move(other.prior.next_factory)); } GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION SeqState& operator=(SeqState&& other) = @@ -710,8 +674,9 @@ struct SeqState { } GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION SeqState(const SeqState& other) noexcept : state(other.state), whence(other.whence) { - CHECK(state == State::kState0); - Construct(&prior.current_promise, other.prior.current_promise); + DCHECK(state == State::kState0); + Construct(&prior.prior.prior.prior.current_promise, + other.prior.prior.prior.prior.current_promise); Construct(&prior.prior.prior.prior.next_factory, other.prior.prior.prior.prior.next_factory); Construct(&prior.prior.prior.next_factory, @@ -722,37 +687,15 @@ struct SeqState { SeqState& operator=(const SeqState& other) = delete; GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION SeqState(SeqState&& other) noexcept : state(other.state), whence(other.whence) { - switch (state) { - case State::kState0: - Construct(&prior.prior.prior.prior.current_promise, - std::move(other.prior.prior.prior.prior.current_promise)); - goto tail0; - case State::kState1: - Construct(&prior.prior.prior.current_promise, - std::move(other.prior.prior.prior.current_promise)); - goto tail1; - case State::kState2: - Construct(&prior.prior.current_promise, - std::move(other.prior.prior.current_promise)); - goto tail2; - case State::kState3: - Construct(&prior.current_promise, - std::move(other.prior.current_promise)); - goto tail3; - case State::kState4: - Construct(¤t_promise, std::move(other.current_promise)); - return; - } - tail0: + DCHECK(state == State::kState0); + Construct(&prior.prior.prior.prior.current_promise, + std::move(other.prior.prior.prior.prior.current_promise)); Construct(&prior.prior.prior.prior.next_factory, std::move(other.prior.prior.prior.prior.next_factory)); - tail1: Construct(&prior.prior.prior.next_factory, std::move(other.prior.prior.prior.next_factory)); - tail2: Construct(&prior.prior.next_factory, std::move(other.prior.prior.next_factory)); - tail3: Construct(&prior.next_factory, std::move(other.prior.next_factory)); } GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION SeqState& operator=(SeqState&& other) = @@ -1033,8 +976,9 @@ struct SeqState { } GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION SeqState(const SeqState& other) noexcept : state(other.state), whence(other.whence) { - CHECK(state == State::kState0); - Construct(&prior.current_promise, other.prior.current_promise); + DCHECK(state == State::kState0); + Construct(&prior.prior.prior.prior.prior.current_promise, + other.prior.prior.prior.prior.prior.current_promise); Construct(&prior.prior.prior.prior.prior.next_factory, other.prior.prior.prior.prior.prior.next_factory); Construct(&prior.prior.prior.prior.next_factory, @@ -1047,45 +991,17 @@ struct SeqState { SeqState& operator=(const SeqState& other) = delete; GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION SeqState(SeqState&& other) noexcept : state(other.state), whence(other.whence) { - switch (state) { - case State::kState0: - Construct( - &prior.prior.prior.prior.prior.current_promise, - std::move(other.prior.prior.prior.prior.prior.current_promise)); - goto tail0; - case State::kState1: - Construct(&prior.prior.prior.prior.current_promise, - std::move(other.prior.prior.prior.prior.current_promise)); - goto tail1; - case State::kState2: - Construct(&prior.prior.prior.current_promise, - std::move(other.prior.prior.prior.current_promise)); - goto tail2; - case State::kState3: - Construct(&prior.prior.current_promise, - std::move(other.prior.prior.current_promise)); - goto tail3; - case State::kState4: - Construct(&prior.current_promise, - std::move(other.prior.current_promise)); - goto tail4; - case State::kState5: - Construct(¤t_promise, std::move(other.current_promise)); - return; - } - tail0: + DCHECK(state == State::kState0); + Construct(&prior.prior.prior.prior.prior.current_promise, + std::move(other.prior.prior.prior.prior.prior.current_promise)); Construct(&prior.prior.prior.prior.prior.next_factory, std::move(other.prior.prior.prior.prior.prior.next_factory)); - tail1: Construct(&prior.prior.prior.prior.next_factory, std::move(other.prior.prior.prior.prior.next_factory)); - tail2: Construct(&prior.prior.prior.next_factory, std::move(other.prior.prior.prior.next_factory)); - tail3: Construct(&prior.prior.next_factory, std::move(other.prior.prior.next_factory)); - tail4: Construct(&prior.next_factory, std::move(other.prior.next_factory)); } GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION SeqState& operator=(SeqState&& other) = @@ -1420,8 +1336,9 @@ struct SeqState { } GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION SeqState(const SeqState& other) noexcept : state(other.state), whence(other.whence) { - CHECK(state == State::kState0); - Construct(&prior.current_promise, other.prior.current_promise); + DCHECK(state == State::kState0); + Construct(&prior.prior.prior.prior.prior.prior.current_promise, + other.prior.prior.prior.prior.prior.prior.current_promise); Construct(&prior.prior.prior.prior.prior.prior.next_factory, other.prior.prior.prior.prior.prior.prior.next_factory); Construct(&prior.prior.prior.prior.prior.next_factory, @@ -1436,55 +1353,21 @@ struct SeqState { SeqState& operator=(const SeqState& other) = delete; GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION SeqState(SeqState&& other) noexcept : state(other.state), whence(other.whence) { - switch (state) { - case State::kState0: - Construct( - &prior.prior.prior.prior.prior.prior.current_promise, - std::move( - other.prior.prior.prior.prior.prior.prior.current_promise)); - goto tail0; - case State::kState1: - Construct( - &prior.prior.prior.prior.prior.current_promise, - std::move(other.prior.prior.prior.prior.prior.current_promise)); - goto tail1; - case State::kState2: - Construct(&prior.prior.prior.prior.current_promise, - std::move(other.prior.prior.prior.prior.current_promise)); - goto tail2; - case State::kState3: - Construct(&prior.prior.prior.current_promise, - std::move(other.prior.prior.prior.current_promise)); - goto tail3; - case State::kState4: - Construct(&prior.prior.current_promise, - std::move(other.prior.prior.current_promise)); - goto tail4; - case State::kState5: - Construct(&prior.current_promise, - std::move(other.prior.current_promise)); - goto tail5; - case State::kState6: - Construct(¤t_promise, std::move(other.current_promise)); - return; - } - tail0: + DCHECK(state == State::kState0); + Construct( + &prior.prior.prior.prior.prior.prior.current_promise, + std::move(other.prior.prior.prior.prior.prior.prior.current_promise)); Construct( &prior.prior.prior.prior.prior.prior.next_factory, std::move(other.prior.prior.prior.prior.prior.prior.next_factory)); - tail1: Construct(&prior.prior.prior.prior.prior.next_factory, std::move(other.prior.prior.prior.prior.prior.next_factory)); - tail2: Construct(&prior.prior.prior.prior.next_factory, std::move(other.prior.prior.prior.prior.next_factory)); - tail3: Construct(&prior.prior.prior.next_factory, std::move(other.prior.prior.prior.next_factory)); - tail4: Construct(&prior.prior.next_factory, std::move(other.prior.prior.next_factory)); - tail5: Construct(&prior.next_factory, std::move(other.prior.next_factory)); } GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION SeqState& operator=(SeqState&& other) = @@ -1873,8 +1756,9 @@ struct SeqState { } GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION SeqState(const SeqState& other) noexcept : state(other.state), whence(other.whence) { - CHECK(state == State::kState0); - Construct(&prior.current_promise, other.prior.current_promise); + DCHECK(state == State::kState0); + Construct(&prior.prior.prior.prior.prior.prior.prior.current_promise, + other.prior.prior.prior.prior.prior.prior.prior.current_promise); Construct(&prior.prior.prior.prior.prior.prior.prior.next_factory, other.prior.prior.prior.prior.prior.prior.prior.next_factory); Construct(&prior.prior.prior.prior.prior.prior.next_factory, @@ -1891,65 +1775,26 @@ struct SeqState { SeqState& operator=(const SeqState& other) = delete; GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION SeqState(SeqState&& other) noexcept : state(other.state), whence(other.whence) { - switch (state) { - case State::kState0: - Construct(&prior.prior.prior.prior.prior.prior.prior.current_promise, - std::move(other.prior.prior.prior.prior.prior.prior.prior - .current_promise)); - goto tail0; - case State::kState1: - Construct( - &prior.prior.prior.prior.prior.prior.current_promise, - std::move( - other.prior.prior.prior.prior.prior.prior.current_promise)); - goto tail1; - case State::kState2: - Construct( - &prior.prior.prior.prior.prior.current_promise, - std::move(other.prior.prior.prior.prior.prior.current_promise)); - goto tail2; - case State::kState3: - Construct(&prior.prior.prior.prior.current_promise, - std::move(other.prior.prior.prior.prior.current_promise)); - goto tail3; - case State::kState4: - Construct(&prior.prior.prior.current_promise, - std::move(other.prior.prior.prior.current_promise)); - goto tail4; - case State::kState5: - Construct(&prior.prior.current_promise, - std::move(other.prior.prior.current_promise)); - goto tail5; - case State::kState6: - Construct(&prior.current_promise, - std::move(other.prior.current_promise)); - goto tail6; - case State::kState7: - Construct(¤t_promise, std::move(other.current_promise)); - return; - } - tail0: + DCHECK(state == State::kState0); + Construct( + &prior.prior.prior.prior.prior.prior.prior.current_promise, + std::move( + other.prior.prior.prior.prior.prior.prior.prior.current_promise)); Construct( &prior.prior.prior.prior.prior.prior.prior.next_factory, std::move( other.prior.prior.prior.prior.prior.prior.prior.next_factory)); - tail1: Construct( &prior.prior.prior.prior.prior.prior.next_factory, std::move(other.prior.prior.prior.prior.prior.prior.next_factory)); - tail2: Construct(&prior.prior.prior.prior.prior.next_factory, std::move(other.prior.prior.prior.prior.prior.next_factory)); - tail3: Construct(&prior.prior.prior.prior.next_factory, std::move(other.prior.prior.prior.prior.next_factory)); - tail4: Construct(&prior.prior.prior.next_factory, std::move(other.prior.prior.prior.next_factory)); - tail5: Construct(&prior.prior.next_factory, std::move(other.prior.prior.next_factory)); - tail6: Construct(&prior.next_factory, std::move(other.prior.next_factory)); } GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION SeqState& operator=(SeqState&& other) = @@ -2394,8 +2239,10 @@ struct SeqState { } GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION SeqState(const SeqState& other) noexcept : state(other.state), whence(other.whence) { - CHECK(state == State::kState0); - Construct(&prior.current_promise, other.prior.current_promise); + DCHECK(state == State::kState0); + Construct( + &prior.prior.prior.prior.prior.prior.prior.prior.current_promise, + other.prior.prior.prior.prior.prior.prior.prior.prior.current_promise); Construct( &prior.prior.prior.prior.prior.prior.prior.prior.next_factory, other.prior.prior.prior.prior.prior.prior.prior.prior.next_factory); @@ -2415,75 +2262,28 @@ struct SeqState { SeqState& operator=(const SeqState& other) = delete; GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION SeqState(SeqState&& other) noexcept : state(other.state), whence(other.whence) { - switch (state) { - case State::kState0: - Construct( - &prior.prior.prior.prior.prior.prior.prior.prior.current_promise, - std::move(other.prior.prior.prior.prior.prior.prior.prior.prior - .current_promise)); - goto tail0; - case State::kState1: - Construct(&prior.prior.prior.prior.prior.prior.prior.current_promise, - std::move(other.prior.prior.prior.prior.prior.prior.prior - .current_promise)); - goto tail1; - case State::kState2: - Construct( - &prior.prior.prior.prior.prior.prior.current_promise, - std::move( - other.prior.prior.prior.prior.prior.prior.current_promise)); - goto tail2; - case State::kState3: - Construct( - &prior.prior.prior.prior.prior.current_promise, - std::move(other.prior.prior.prior.prior.prior.current_promise)); - goto tail3; - case State::kState4: - Construct(&prior.prior.prior.prior.current_promise, - std::move(other.prior.prior.prior.prior.current_promise)); - goto tail4; - case State::kState5: - Construct(&prior.prior.prior.current_promise, - std::move(other.prior.prior.prior.current_promise)); - goto tail5; - case State::kState6: - Construct(&prior.prior.current_promise, - std::move(other.prior.prior.current_promise)); - goto tail6; - case State::kState7: - Construct(&prior.current_promise, - std::move(other.prior.current_promise)); - goto tail7; - case State::kState8: - Construct(¤t_promise, std::move(other.current_promise)); - return; - } - tail0: + DCHECK(state == State::kState0); + Construct(&prior.prior.prior.prior.prior.prior.prior.prior.current_promise, + std::move(other.prior.prior.prior.prior.prior.prior.prior.prior + .current_promise)); Construct(&prior.prior.prior.prior.prior.prior.prior.prior.next_factory, std::move(other.prior.prior.prior.prior.prior.prior.prior.prior .next_factory)); - tail1: Construct( &prior.prior.prior.prior.prior.prior.prior.next_factory, std::move( other.prior.prior.prior.prior.prior.prior.prior.next_factory)); - tail2: Construct( &prior.prior.prior.prior.prior.prior.next_factory, std::move(other.prior.prior.prior.prior.prior.prior.next_factory)); - tail3: Construct(&prior.prior.prior.prior.prior.next_factory, std::move(other.prior.prior.prior.prior.prior.next_factory)); - tail4: Construct(&prior.prior.prior.prior.next_factory, std::move(other.prior.prior.prior.prior.next_factory)); - tail5: Construct(&prior.prior.prior.next_factory, std::move(other.prior.prior.prior.next_factory)); - tail6: Construct(&prior.prior.next_factory, std::move(other.prior.prior.next_factory)); - tail7: Construct(&prior.next_factory, std::move(other.prior.next_factory)); } GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION SeqState& operator=(SeqState&& other) = @@ -2989,8 +2789,11 @@ struct SeqState { } GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION SeqState(const SeqState& other) noexcept : state(other.state), whence(other.whence) { - CHECK(state == State::kState0); - Construct(&prior.current_promise, other.prior.current_promise); + DCHECK(state == State::kState0); + Construct( + &prior.prior.prior.prior.prior.prior.prior.prior.prior.current_promise, + other.prior.prior.prior.prior.prior.prior.prior.prior.prior + .current_promise); Construct( &prior.prior.prior.prior.prior.prior.prior.prior.prior.next_factory, other.prior.prior.prior.prior.prior.prior.prior.prior.prior @@ -3014,86 +2817,33 @@ struct SeqState { SeqState& operator=(const SeqState& other) = delete; GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION SeqState(SeqState&& other) noexcept : state(other.state), whence(other.whence) { - switch (state) { - case State::kState0: - Construct(&prior.prior.prior.prior.prior.prior.prior.prior.prior - .current_promise, - std::move(other.prior.prior.prior.prior.prior.prior.prior - .prior.prior.current_promise)); - goto tail0; - case State::kState1: - Construct( - &prior.prior.prior.prior.prior.prior.prior.prior.current_promise, - std::move(other.prior.prior.prior.prior.prior.prior.prior.prior - .current_promise)); - goto tail1; - case State::kState2: - Construct(&prior.prior.prior.prior.prior.prior.prior.current_promise, - std::move(other.prior.prior.prior.prior.prior.prior.prior - .current_promise)); - goto tail2; - case State::kState3: - Construct( - &prior.prior.prior.prior.prior.prior.current_promise, - std::move( - other.prior.prior.prior.prior.prior.prior.current_promise)); - goto tail3; - case State::kState4: - Construct( - &prior.prior.prior.prior.prior.current_promise, - std::move(other.prior.prior.prior.prior.prior.current_promise)); - goto tail4; - case State::kState5: - Construct(&prior.prior.prior.prior.current_promise, - std::move(other.prior.prior.prior.prior.current_promise)); - goto tail5; - case State::kState6: - Construct(&prior.prior.prior.current_promise, - std::move(other.prior.prior.prior.current_promise)); - goto tail6; - case State::kState7: - Construct(&prior.prior.current_promise, - std::move(other.prior.prior.current_promise)); - goto tail7; - case State::kState8: - Construct(&prior.current_promise, - std::move(other.prior.current_promise)); - goto tail8; - case State::kState9: - Construct(¤t_promise, std::move(other.current_promise)); - return; - } - tail0: + DCHECK(state == State::kState0); + Construct( + &prior.prior.prior.prior.prior.prior.prior.prior.prior.current_promise, + std::move(other.prior.prior.prior.prior.prior.prior.prior.prior.prior + .current_promise)); Construct( &prior.prior.prior.prior.prior.prior.prior.prior.prior.next_factory, std::move(other.prior.prior.prior.prior.prior.prior.prior.prior.prior .next_factory)); - tail1: Construct(&prior.prior.prior.prior.prior.prior.prior.prior.next_factory, std::move(other.prior.prior.prior.prior.prior.prior.prior.prior .next_factory)); - tail2: Construct( &prior.prior.prior.prior.prior.prior.prior.next_factory, std::move( other.prior.prior.prior.prior.prior.prior.prior.next_factory)); - tail3: Construct( &prior.prior.prior.prior.prior.prior.next_factory, std::move(other.prior.prior.prior.prior.prior.prior.next_factory)); - tail4: Construct(&prior.prior.prior.prior.prior.next_factory, std::move(other.prior.prior.prior.prior.prior.next_factory)); - tail5: Construct(&prior.prior.prior.prior.next_factory, std::move(other.prior.prior.prior.prior.next_factory)); - tail6: Construct(&prior.prior.prior.next_factory, std::move(other.prior.prior.prior.next_factory)); - tail7: Construct(&prior.prior.next_factory, std::move(other.prior.prior.next_factory)); - tail8: Construct(&prior.next_factory, std::move(other.prior.next_factory)); } GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION SeqState& operator=(SeqState&& other) = @@ -3660,8 +3410,11 @@ struct SeqState { } GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION SeqState(const SeqState& other) noexcept : state(other.state), whence(other.whence) { - CHECK(state == State::kState0); - Construct(&prior.current_promise, other.prior.current_promise); + DCHECK(state == State::kState0); + Construct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior + .current_promise, + other.prior.prior.prior.prior.prior.prior.prior.prior.prior.prior + .current_promise); Construct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior .next_factory, other.prior.prior.prior.prior.prior.prior.prior.prior.prior.prior @@ -3689,97 +3442,37 @@ struct SeqState { SeqState& operator=(const SeqState& other) = delete; GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION SeqState(SeqState&& other) noexcept : state(other.state), whence(other.whence) { - switch (state) { - case State::kState0: - Construct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior - .current_promise, - std::move(other.prior.prior.prior.prior.prior.prior.prior - .prior.prior.prior.current_promise)); - goto tail0; - case State::kState1: - Construct(&prior.prior.prior.prior.prior.prior.prior.prior.prior - .current_promise, - std::move(other.prior.prior.prior.prior.prior.prior.prior - .prior.prior.current_promise)); - goto tail1; - case State::kState2: - Construct( - &prior.prior.prior.prior.prior.prior.prior.prior.current_promise, - std::move(other.prior.prior.prior.prior.prior.prior.prior.prior - .current_promise)); - goto tail2; - case State::kState3: - Construct(&prior.prior.prior.prior.prior.prior.prior.current_promise, - std::move(other.prior.prior.prior.prior.prior.prior.prior - .current_promise)); - goto tail3; - case State::kState4: - Construct( - &prior.prior.prior.prior.prior.prior.current_promise, - std::move( - other.prior.prior.prior.prior.prior.prior.current_promise)); - goto tail4; - case State::kState5: - Construct( - &prior.prior.prior.prior.prior.current_promise, - std::move(other.prior.prior.prior.prior.prior.current_promise)); - goto tail5; - case State::kState6: - Construct(&prior.prior.prior.prior.current_promise, - std::move(other.prior.prior.prior.prior.current_promise)); - goto tail6; - case State::kState7: - Construct(&prior.prior.prior.current_promise, - std::move(other.prior.prior.prior.current_promise)); - goto tail7; - case State::kState8: - Construct(&prior.prior.current_promise, - std::move(other.prior.prior.current_promise)); - goto tail8; - case State::kState9: - Construct(&prior.current_promise, - std::move(other.prior.current_promise)); - goto tail9; - case State::kState10: - Construct(¤t_promise, std::move(other.current_promise)); - return; - } - tail0: + DCHECK(state == State::kState0); + Construct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior + .current_promise, + std::move(other.prior.prior.prior.prior.prior.prior.prior.prior + .prior.prior.current_promise)); Construct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior .next_factory, std::move(other.prior.prior.prior.prior.prior.prior.prior.prior .prior.prior.next_factory)); - tail1: Construct( &prior.prior.prior.prior.prior.prior.prior.prior.prior.next_factory, std::move(other.prior.prior.prior.prior.prior.prior.prior.prior.prior .next_factory)); - tail2: Construct(&prior.prior.prior.prior.prior.prior.prior.prior.next_factory, std::move(other.prior.prior.prior.prior.prior.prior.prior.prior .next_factory)); - tail3: Construct( &prior.prior.prior.prior.prior.prior.prior.next_factory, std::move( other.prior.prior.prior.prior.prior.prior.prior.next_factory)); - tail4: Construct( &prior.prior.prior.prior.prior.prior.next_factory, std::move(other.prior.prior.prior.prior.prior.prior.next_factory)); - tail5: Construct(&prior.prior.prior.prior.prior.next_factory, std::move(other.prior.prior.prior.prior.prior.next_factory)); - tail6: Construct(&prior.prior.prior.prior.next_factory, std::move(other.prior.prior.prior.prior.next_factory)); - tail7: Construct(&prior.prior.prior.next_factory, std::move(other.prior.prior.prior.next_factory)); - tail8: Construct(&prior.prior.next_factory, std::move(other.prior.prior.next_factory)); - tail9: Construct(&prior.next_factory, std::move(other.prior.next_factory)); } GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION SeqState& operator=(SeqState&& other) = @@ -4408,8 +4101,11 @@ struct SeqState { } GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION SeqState(const SeqState& other) noexcept : state(other.state), whence(other.whence) { - CHECK(state == State::kState0); - Construct(&prior.current_promise, other.prior.current_promise); + DCHECK(state == State::kState0); + Construct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior.prior + .current_promise, + other.prior.prior.prior.prior.prior.prior.prior.prior.prior.prior + .prior.current_promise); Construct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior.prior .next_factory, other.prior.prior.prior.prior.prior.prior.prior.prior.prior.prior @@ -4441,108 +4137,41 @@ struct SeqState { SeqState& operator=(const SeqState& other) = delete; GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION SeqState(SeqState&& other) noexcept : state(other.state), whence(other.whence) { - switch (state) { - case State::kState0: - Construct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior - .prior.current_promise, - std::move(other.prior.prior.prior.prior.prior.prior.prior - .prior.prior.prior.prior.current_promise)); - goto tail0; - case State::kState1: - Construct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior - .current_promise, - std::move(other.prior.prior.prior.prior.prior.prior.prior - .prior.prior.prior.current_promise)); - goto tail1; - case State::kState2: - Construct(&prior.prior.prior.prior.prior.prior.prior.prior.prior - .current_promise, - std::move(other.prior.prior.prior.prior.prior.prior.prior - .prior.prior.current_promise)); - goto tail2; - case State::kState3: - Construct( - &prior.prior.prior.prior.prior.prior.prior.prior.current_promise, - std::move(other.prior.prior.prior.prior.prior.prior.prior.prior - .current_promise)); - goto tail3; - case State::kState4: - Construct(&prior.prior.prior.prior.prior.prior.prior.current_promise, - std::move(other.prior.prior.prior.prior.prior.prior.prior - .current_promise)); - goto tail4; - case State::kState5: - Construct( - &prior.prior.prior.prior.prior.prior.current_promise, - std::move( - other.prior.prior.prior.prior.prior.prior.current_promise)); - goto tail5; - case State::kState6: - Construct( - &prior.prior.prior.prior.prior.current_promise, - std::move(other.prior.prior.prior.prior.prior.current_promise)); - goto tail6; - case State::kState7: - Construct(&prior.prior.prior.prior.current_promise, - std::move(other.prior.prior.prior.prior.current_promise)); - goto tail7; - case State::kState8: - Construct(&prior.prior.prior.current_promise, - std::move(other.prior.prior.prior.current_promise)); - goto tail8; - case State::kState9: - Construct(&prior.prior.current_promise, - std::move(other.prior.prior.current_promise)); - goto tail9; - case State::kState10: - Construct(&prior.current_promise, - std::move(other.prior.current_promise)); - goto tail10; - case State::kState11: - Construct(¤t_promise, std::move(other.current_promise)); - return; - } - tail0: + DCHECK(state == State::kState0); + Construct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior.prior + .current_promise, + std::move(other.prior.prior.prior.prior.prior.prior.prior.prior + .prior.prior.prior.current_promise)); Construct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior.prior .next_factory, std::move(other.prior.prior.prior.prior.prior.prior.prior.prior .prior.prior.prior.next_factory)); - tail1: Construct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior .next_factory, std::move(other.prior.prior.prior.prior.prior.prior.prior.prior .prior.prior.next_factory)); - tail2: Construct( &prior.prior.prior.prior.prior.prior.prior.prior.prior.next_factory, std::move(other.prior.prior.prior.prior.prior.prior.prior.prior.prior .next_factory)); - tail3: Construct(&prior.prior.prior.prior.prior.prior.prior.prior.next_factory, std::move(other.prior.prior.prior.prior.prior.prior.prior.prior .next_factory)); - tail4: Construct( &prior.prior.prior.prior.prior.prior.prior.next_factory, std::move( other.prior.prior.prior.prior.prior.prior.prior.next_factory)); - tail5: Construct( &prior.prior.prior.prior.prior.prior.next_factory, std::move(other.prior.prior.prior.prior.prior.prior.next_factory)); - tail6: Construct(&prior.prior.prior.prior.prior.next_factory, std::move(other.prior.prior.prior.prior.prior.next_factory)); - tail7: Construct(&prior.prior.prior.prior.next_factory, std::move(other.prior.prior.prior.prior.next_factory)); - tail8: Construct(&prior.prior.prior.next_factory, std::move(other.prior.prior.prior.next_factory)); - tail9: Construct(&prior.prior.next_factory, std::move(other.prior.prior.next_factory)); - tail10: Construct(&prior.next_factory, std::move(other.prior.next_factory)); } GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION SeqState& operator=(SeqState&& other) = @@ -5235,8 +4864,11 @@ struct SeqState { } GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION SeqState(const SeqState& other) noexcept : state(other.state), whence(other.whence) { - CHECK(state == State::kState0); - Construct(&prior.current_promise, other.prior.current_promise); + DCHECK(state == State::kState0); + Construct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior.prior + .prior.current_promise, + other.prior.prior.prior.prior.prior.prior.prior.prior.prior.prior + .prior.prior.current_promise); Construct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior.prior .prior.next_factory, other.prior.prior.prior.prior.prior.prior.prior.prior.prior.prior @@ -5272,120 +4904,45 @@ struct SeqState { SeqState& operator=(const SeqState& other) = delete; GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION SeqState(SeqState&& other) noexcept : state(other.state), whence(other.whence) { - switch (state) { - case State::kState0: - Construct( - &prior.prior.prior.prior.prior.prior.prior.prior.prior.prior.prior - .prior.current_promise, - std::move(other.prior.prior.prior.prior.prior.prior.prior.prior - .prior.prior.prior.prior.current_promise)); - goto tail0; - case State::kState1: - Construct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior - .prior.current_promise, - std::move(other.prior.prior.prior.prior.prior.prior.prior - .prior.prior.prior.prior.current_promise)); - goto tail1; - case State::kState2: - Construct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior - .current_promise, - std::move(other.prior.prior.prior.prior.prior.prior.prior - .prior.prior.prior.current_promise)); - goto tail2; - case State::kState3: - Construct(&prior.prior.prior.prior.prior.prior.prior.prior.prior - .current_promise, - std::move(other.prior.prior.prior.prior.prior.prior.prior - .prior.prior.current_promise)); - goto tail3; - case State::kState4: - Construct( - &prior.prior.prior.prior.prior.prior.prior.prior.current_promise, - std::move(other.prior.prior.prior.prior.prior.prior.prior.prior - .current_promise)); - goto tail4; - case State::kState5: - Construct(&prior.prior.prior.prior.prior.prior.prior.current_promise, - std::move(other.prior.prior.prior.prior.prior.prior.prior - .current_promise)); - goto tail5; - case State::kState6: - Construct( - &prior.prior.prior.prior.prior.prior.current_promise, - std::move( - other.prior.prior.prior.prior.prior.prior.current_promise)); - goto tail6; - case State::kState7: - Construct( - &prior.prior.prior.prior.prior.current_promise, - std::move(other.prior.prior.prior.prior.prior.current_promise)); - goto tail7; - case State::kState8: - Construct(&prior.prior.prior.prior.current_promise, - std::move(other.prior.prior.prior.prior.current_promise)); - goto tail8; - case State::kState9: - Construct(&prior.prior.prior.current_promise, - std::move(other.prior.prior.prior.current_promise)); - goto tail9; - case State::kState10: - Construct(&prior.prior.current_promise, - std::move(other.prior.prior.current_promise)); - goto tail10; - case State::kState11: - Construct(&prior.current_promise, - std::move(other.prior.current_promise)); - goto tail11; - case State::kState12: - Construct(¤t_promise, std::move(other.current_promise)); - return; - } - tail0: + DCHECK(state == State::kState0); + Construct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior.prior + .prior.current_promise, + std::move(other.prior.prior.prior.prior.prior.prior.prior.prior + .prior.prior.prior.prior.current_promise)); Construct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior.prior .prior.next_factory, std::move(other.prior.prior.prior.prior.prior.prior.prior.prior .prior.prior.prior.prior.next_factory)); - tail1: Construct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior.prior .next_factory, std::move(other.prior.prior.prior.prior.prior.prior.prior.prior .prior.prior.prior.next_factory)); - tail2: Construct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior .next_factory, std::move(other.prior.prior.prior.prior.prior.prior.prior.prior .prior.prior.next_factory)); - tail3: Construct( &prior.prior.prior.prior.prior.prior.prior.prior.prior.next_factory, std::move(other.prior.prior.prior.prior.prior.prior.prior.prior.prior .next_factory)); - tail4: Construct(&prior.prior.prior.prior.prior.prior.prior.prior.next_factory, std::move(other.prior.prior.prior.prior.prior.prior.prior.prior .next_factory)); - tail5: Construct( &prior.prior.prior.prior.prior.prior.prior.next_factory, std::move( other.prior.prior.prior.prior.prior.prior.prior.next_factory)); - tail6: Construct( &prior.prior.prior.prior.prior.prior.next_factory, std::move(other.prior.prior.prior.prior.prior.prior.next_factory)); - tail7: Construct(&prior.prior.prior.prior.prior.next_factory, std::move(other.prior.prior.prior.prior.prior.next_factory)); - tail8: Construct(&prior.prior.prior.prior.next_factory, std::move(other.prior.prior.prior.prior.next_factory)); - tail9: Construct(&prior.prior.prior.next_factory, std::move(other.prior.prior.prior.next_factory)); - tail10: Construct(&prior.prior.next_factory, std::move(other.prior.prior.next_factory)); - tail11: Construct(&prior.next_factory, std::move(other.prior.next_factory)); } GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION SeqState& operator=(SeqState&& other) = diff --git a/tools/codegen/core/gen_join.py b/tools/codegen/core/gen_join.py index 418b7c87219..d0bd3434a07 100755 --- a/tools/codegen/core/gen_join.py +++ b/tools/codegen/core/gen_join.py @@ -46,13 +46,10 @@ struct JoinState { } JoinState& operator=(const JoinState& other) = delete; JoinState& operator=(JoinState&& other) = delete; - GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION JoinState(JoinState&& other) noexcept : ready(other.ready) { + GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION JoinState(JoinState&& other) noexcept { + DCHECK(other.ready.none()); % for i in range(0,n): - if (ready.is_set(${i})) { - Construct(&result${i}, std::move(other.result${i})); - } else { - Construct(&promise${i}, std::move(other.promise${i})); - } + Construct(&promise${i}, std::move(other.promise${i})); % endfor } GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION ~JoinState() { diff --git a/tools/codegen/core/gen_seq.py b/tools/codegen/core/gen_seq.py index faa5b65a4eb..f537fd63f9c 100755 --- a/tools/codegen/core/gen_seq.py +++ b/tools/codegen/core/gen_seq.py @@ -110,9 +110,9 @@ tail${i}: % endfor } GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION SeqState(const SeqState& other) noexcept : state(other.state), whence(other.whence) { - CHECK(state == State::kState0); - Construct(&${"prior."*(n-1-i)}current_promise, - other.${"prior."*(n-1-i)}current_promise); + DCHECK(state == State::kState0); + Construct(&${"prior."*(n-1)}current_promise, + other.${"prior."*(n-1)}current_promise); % for i in range(0,n-1): Construct(&${"prior."*(n-1-i)}next_factory, other.${"prior."*(n-1-i)}next_factory); @@ -120,19 +120,10 @@ tail${i}: } SeqState& operator=(const SeqState& other) = delete; GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION SeqState(SeqState&& other) noexcept : state(other.state), whence(other.whence) { - switch (state) { + DCHECK(state == State::kState0); + Construct(&${"prior."*(n-1)}current_promise, + std::move(other.${"prior."*(n-1)}current_promise)); % for i in range(0,n-1): - case State::kState${i}: - Construct(&${"prior."*(n-1-i)}current_promise, - std::move(other.${"prior."*(n-1-i)}current_promise)); - goto tail${i}; -% endfor - case State::kState${n-1}: - Construct(¤t_promise, std::move(other.current_promise)); - return; - } -% for i in range(0,n-1): -tail${i}: Construct(&${"prior."*(n-1-i)}next_factory, std::move(other.${"prior."*(n-1-i)}next_factory)); % endfor