Skip to content

Split ~future_base() into inline fast path + out-of-line slow path - #108

Merged
kammce merged 1 commit into
mainfrom
split-destructor-fast-path
Aug 30, 2026
Merged

Split ~future_base() into inline fast path + out-of-line slow path#108
kammce merged 1 commit into
mainfrom
split-destructor-fast-path

Conversation

@kammce

@kammce kammce commented Aug 30, 2026

Copy link
Copy Markdown
Member

Summary

  • The common case (m_tag == state_tag::value) needs no cleanup, so ~future_base() now only does a single inline branch check.
  • The exception_ptr release / coroutine cancel cleanup moves into a new destroy_slow(), marked [[unlikely]] at the call site and out-of-line, shared across every future<T> instantiation — same pattern as the existing throw_failure().
  • No behavior change; this is a codegen/size optimization (patch-level).

Test plan

  • conan build . -pr:a hal/tc/gcc — existing unit tests pass unmodified

…ow path

The common case (m_tag == state_tag::value) needs no cleanup, so keep
only that check inline in the destructor. The exception_ptr/cancel
cleanup moves into destroy_slow(), out-of-line and shared across every
future<T> instantiation, mirroring the existing throw_failure() pattern.
@kammce
kammce merged commit 66424a3 into main Aug 30, 2026
8 checks passed
@kammce
kammce deleted the split-destructor-fast-path branch August 30, 2026 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant