~/lightning

Lightning Talk: Implementing Coroutines Using C++17

Lightningat CppCon 2023 · on Monday, 2023-10-02· [rust]
name:Alon Wolf
links:none on file
slides:none on file

An implementation reproduces coroutines on C++17 using macros, template metaprogramming, and assembly, a surprisingly compact ~200 lines with a test that still runs. Resume is implemented by an assembly helper that smashes the return address and a noinline builtin-return-address function; empty asm forces register reloads to avoid compiler assumptions. Locals live in generated nested frame structs found by a compile-time counter, with computed alignment/size for storage and explicit cleanup propagation so the coroutine actually suspends, resumes, and destroys correctly.

AI-written summary · about

~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.