JSPI integration
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
- Da chiarire
- Stato di attività
- Ferma
- Stack tecnologico
- wasm
- Ambito
- compilers
Direzione di ricerca
Start with the JSPI integration description, especially WebAssembly.Suspending, WebAssembly.promising, Promise.then, the imported JSPI event tag, and resume_throw. Determine whether the JSPI event should be importable and specify the behavior and use cases clearly enough for a follow-up proposal or implementation.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
JSPI can be seen (and potentially re-specified) as using core stack switching. Specifically, the WebAssembly.Suspending import wrappers can be seen as suspending with a JSPI event tag with type [externref] -> [externref]. The externref sent on the suspension is the Promise whose resolution will resume the suspended WebAssembly. The JSPI event is handled in the WebAssembly.promising export wrapper, which calls Promise.then to arrange for the continuation to be resumed when the promise is resolved. When the continuation is resumed, the WebAssembly.Suspending wrapper has to do some additional work to unbox the values from the resolved Promise and return them back into Wasm.
This formulation of JSPI raises the questions of what would happen if the JSPI event tag were made available to be imported into user Wasm modules and whether this would be useful to allow.
Suspending with the imported JSPI tag and accompanying externref holding a Promise would be equivalent to calling an imported JSPI-wrapped JS function that simply takes and returns that Promise, but without the overhead of actually calling an import. If the suspension reaches a WebAssembly.promising export wrapper, it would chain the resumption of the resulting continuation onto the Promise just like it would for a "normal" JSPI suspension.
Handling an event with the JSPI tag would give you an externref holding a Promise and a continuation. At that point you could call out to JS to manually chain the continuation onto the Promise like the normal WebAssembly.promising export wrapper does, or alternatively you could do anything else. For example, you might chain a callback onto the Promise that does not immediately resume the continuation, but rather puts it onto some application-managed scheduling queue. Or maybe you could arrange for the continuation to be canceled with resume_throw if the Promise is not resolved within a certain amount of time. The possibilities are endless, and more importantly, they cannot be fully replicated just by JSPI and import calls.
In conclusion, I think that yes, it would be reasonable and useful to make the JSPI event importable. (But of course we can always add this as a follow-up once demand for it materializes.)
- 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 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 45/100
WebAssembly/stack-switching#128 · 6 commenti ·
-
What is needed for phase 3? Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 20/100
WebAssembly/stack-switching#122 · 3 commenti ·
Tutte le issue di WebAssembly/stack-switching
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
objectionary/eo#8923 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Coarray integration tests carry no LABELS, so run_tests.py silently skips them under every backend Apertacoarray
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
internal.h中,漏掉了1个定义。 Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 95/100