Motivation
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 25/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- wasm
- Ambito
- compilers
Direzione di ricerca
Start with the issue's Motivation section and the linked LLVM Coroutines documentation. Review how the proposal distinguishes compiler transformations for async/await and generators from stack switching for green threads. Done means the proposal's motivation and scope clearly reflect the intended use case.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
At the moment, the overview gives these goals:
Motivation
- Support for Asynch/await programming pattern.
- Support for green threads.
- Support for yield-style generators.
Of these, only green threads require any changes to WebAssembly:
- Async/await programming can relatively easily be implemented in the compiler. In particular, LLVM has implemented it as a series of passes, which you can read about here. In my experience, this works really well even in WebAssembly because after the passes have done their work, the code is converted to a form that looks like hand-written async code. No special features from the instruction set are required for this to work: the only requirement is the ability to call a function pointer.
- Yield-style generators are actually very similar to async/await and can also be implemented as a compiler pass. LLVM supports them using the same coroutine passes. Again, no special features are required from the instruction set.
While I've only mentioned LLVM above, other compilers do something similar. I believe Rust has a separate implementation of async/await (it doesn't appear to use LLVM coroutines). But an easier way to understand why async/await and yield-style generators do not need WebAssembly support is by realizing that they can all be implemented manually, by hand. And if it can be written by hand, a compiler can perform that transformation for you as a compiler pass.
What cannot be written by hand is stack switching. In particular, this is a problem in Go which uses stack switching extensively for goroutines (every blocking operation potentially results in a stack switch).
Therefore, I would propose that this proposal only focuses on the green threads use case, that requires stack switching (as evident from the name: stack-switching). Of course you could potentially use stack switching for async/await and yield-style generators, but I do not think we should focus on them as there are already ways to efficiently support them in WebAssembly.
- Lingua principale
- WebAssembly
- Stelle
- 216
- Fork
- 19
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di WebAssembly/stack-switching
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
WebAssembly/stack-switching#156 · 1 commento ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
WebAssembly/stack-switching#145 · 4 commenti ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
WebAssembly/stack-switching#144 · 4 commenti ·
-
JSPI integration Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
WebAssembly/stack-switching#131 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 45/100
WebAssembly/stack-switching#128 · 6 commenti ·
Tutte le issue di WebAssembly/stack-switching
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
JakeChampion/lang#10213 ·
-
enhancement good first issue needs testing
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
bradcypert/plum#58 ·
-
flang:fir-hlfir
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
llvm/llvm-project#225935 ·
-
Hand Tail: Brass Herald Apertaarea:cards hand-tail ready-for-agent
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
fil-donadoni/tolaria#4446 ·