Repository navigation
Open
Labels
enhancementA request for a new feature or improvement.help wantedThe issue requires extra attention or help from others.needs testingIssues that require additional testing or verification.
Description
Parent: #439
Depends on: #440 and #442.
Summary
Lower typed async functions into a backend-neutral resumable state-machine representation before LLVM emission.
Required contract
- Split control flow at await sites and assign deterministic suspension states.
- Move locals that survive suspension into an explicit frame with target-correct size and alignment.
- Preserve return, loop, match, branch, and early-completion behavior across suspension.
- Represent ready, pending, failure, and cancellation according to the agreed semantic contract.
- Keep raw pointer values unchanged while documenting that pointee validity remains the program's responsibility.
- Support nested awaits, multiple awaits, generic specializations, and async calls returning variants or structs.
- Do not use LLVM coroutine intrinsics as the public or frontend contract; LLVM-specific optimization may be added behind the lowered representation.
Completion criteria
- A backend-neutral async frame/state-machine IR is documented in code and consumed by LLVM.
- Generated LLVM verifies for x86_64, AArch64, and RV64 layouts.
- Locals live across exactly the required suspension states.
- Completed frames cannot resume again, and cancelled frames follow the defined cleanup contract.
- Regression tests cover branches, loops, match, nested calls, generics, and pointer-bearing frames.
- No valid async program reaches an unimplemented-node panic in LLVM.
This is a high-difficulty compiler task.
Implementation audit — 2026-09-23
AsyncFrame/AsyncState/Transition are implemented before LLVM lowering, and async_frames_emit_for_enabled_native_targets passes. Runtime control-flow fixtures also pass locally. Retain this issue for exact suspension liveness and the remaining frame/cancellation acceptance audit; existing code currently creates explicit frame slots broadly.
Metadata
Metadata
Assignees
Labels
enhancementA request for a new feature or improvement.help wantedThe issue requires extra attention or help from others.needs testingIssues that require additional testing or verification.
Activity