The current implementation of async
is modeled on state machines. Every async function has a Frame struct, which looks something like this:
const Frame = struct {
ptrToFunction: usize,
state: usize,
parent_frame: usize,
ptr_to_return_value: *ReturnType,
locals: struct { ... },
};