Motivation
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 25/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- wasm
- 領域
- compilers
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- WebAssembly
- スター
- 216
- フォーク
- 19
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
WebAssembly/stack-switching のほかの issue
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
WebAssembly/stack-switching#156 · コメント 1 件 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
WebAssembly/stack-switching#145 · コメント 4 件 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
WebAssembly/stack-switching#144 · コメント 4 件 ·
-
JSPI integrationオープン
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
WebAssembly/stack-switching#131 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 45/100
WebAssembly/stack-switching#128 · コメント 6 件 ·
WebAssembly/stack-switching の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
yhirose/cpp-peglib#344 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
build-problem llvm:adt
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
llvm/llvm-project#228475 ·
メンテナーはふだん 1 日以内に返信