Component Model Async ABI の Stackless(callback)/Stackful 2 系統・Waitable Sets・task.return 仕様と未リリース制約
- Stackless / Stackful の 2 系統 Async ABI: Component Model の
asyncCanonical Option(バイナリ0x06,🔀)には、callbackオプション(0x07,🔀)の有無により 2 つのサブ ABI が定義されている(Concurrency.mdL170–175,Binary.mdL365–366)。- Stackless async ABI(
callback指定あり):async/await等を採用するスタックレス並行言語向け。Core Wasm はWAIT/YIELD終了コードを返してイベントループへ制御を戻し(ネイティブスタックを解放)、イベント進展時にホストがcallback関数を呼び出す。 - Stackful async ABI(
callback指定なし):waitable-set.waitを呼び出してその場でブロックし、ホスト側で Wasm スタックを保存・再開する。
- Stackless async ABI(
- Waitable sets と
task.return:- epoll 風の待機プリミティブとして
waitable-set.new(0x1f)・waitable-set.wait(0x20)・waitable-set.poll(0x21)・waitable-set.drop(0x22)・waitable.join(0x23)が🔀ゲート下で定義されている(Binary.mdL337–341)。 asyncリフトされた Core 関数は、戻り値を返した後もstream/futureの読み書きを継続できるよう、Core 関数の通常返り値ではなくcanon task.return(0x09,🔀)組み込み命令で結果を返す(Concurrency.mdL730–753)。
- epoll 風の待機プリミティブとして
- Stackful ABI 未リリースに伴うキャンセル・運用制約:
- 規範仕様
Concurrency.md(L820–825)は、現時点でキャンセル可能("task cancelled"イベント受信可能)なのはcallback(Stackless)ABI を使用してイベントループへ制御を返しているスレッドのみ であり、waitable-set.wait経由で"task cancelled"を配送する仕組みは Stackful ABI リリース前の将来課題(TODO) であると明記している。 - Bytecode Alliance 公式ブログ(2026-12-01、Tier 2)でも、Stackful ABI は未リリースであり
callback(Stackless ABI)の指定が引き続き必須である旨が報告されている。
- 規範仕様
- WASI リリース版および協調スレッドゲートとの突合(2026-12-03 確認):
- 上記 Bytecode Alliance 記事では「WASI 0.3.3 時点」と言及されているが、公式規範リポジトリ
WebAssembly/WASIにおける最新リリース仕様は WASI0.3.2(2026-10-13 公開、commit 463701e0)であり、0.3.3のタグおよび仕様ディレクトリは未公開である。 - また
docs/ComponentModelFeatures.md上、WASI 0.3.0〜0.3.2 で採用済みの非同期ゲートは🔀(asynclift/lower・future・stream・waitable-set.*・task.return・thread.yield)であり、協調スレッド群(thread.new-indirect/thread.suspend等、🧵ゲート)は未採用である。
- 上記 Bytecode Alliance 記事では「WASI 0.3.3 時点」と言及されているが、公式規範リポジトリ
関連概念・ファクト
- implementsComponent Model の Colorless Native Async とバックプレッシャー制御 — Colorless Native Async を支える Stackless / Stackful ABI・Waitable sets・
task.returnの規範仕様。 - depends_onComponent Model Async ABI の Colorless 呼び出し規則とバックプレッシャー命令仕様 —
async効果型・Sync/Async 相互運用・バックプレッシャー命令の基礎仕様。 - depends_onWASI 0.2.12 と WASI 0.3.2 の収録パッケージ構成および必須 Component Model 機能 — WASI 0.3.2 における必須 Component Model gated features の採用一覧。
Primary Sources
- Tier 1 WebAssembly Component Model Specification
design/mvp/Concurrency.md (L113-114, L170-175, L552-557, L730-753, L820-825) & Binary.md (L312, L337-357, L365-366, commit 232a4cbc)↗ - Tier 1 WebAssembly System Interface (WASI) Specification Repository
specifications/wasi-0.3.2/Overview.md & docs/ComponentModelFeatures.md (commit 463701e0)↗ - Tier 2 The Async Component Model (Bytecode Alliance Blog)
What is introduced? / How do functions block? / Returning (Tier 2 supplementary)↗
Relations
Outgoing
- depends_on Component Model Async ABI の Colorless 呼び出し規則とバックプレッシャー命令仕様
- depends_on WASI 0.2.12 と WASI 0.3.2 の収録パッケージ構成および必須 Component Model 機能
- implements Component Model の Colorless Native Async とバックプレッシャー制御