Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Add support for snapshotting tables

オープン
#29 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
25/100
issue の種類
機能追加
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
rust, wasm
領域
devtools

調査の方向性

まず、issue に記載されている Wizer の instrumentation と snapshotting のパスを追跡します。ファイルやテストは指定されていません。リンクされたインスタンス間で funcref の identity をどのように表現するか、また imported 関数と WASI 関数をどのように扱うかを判断し、externref の初期化動作を維持します。両方の table kind を snapshot でき、module-linking のケースがカバーされれば完了です。

索引モデルが issue の本文から書いたものです。

説明

Right now there are two potential kinds of tables:

  • funcref tables
  • externref tables

The latter are easy to support, since Wasm can't construct an externref, only receive it from the outside world. As long as we don't allow any externrefs into the Wasm during initialization, then all we have to do is record the initialized size of these tables.

funcref tables are a little harder. Wasm can create funcrefs via the ref.func instruction. So we need a way to figure out which function each wasmtime::FuncRef in a table we are snapshotting is (i.e. what is the local function index of the ith table element?). wasmtime doesn't expose anything like that. I have an idea, however:

  • during Wizer's instrumentation phase:
    • add two new globals to the module: $wizer_getting_func_index and $wizer_func_index
    • add the following snippet to the start of every function in the module:
      block
        global.get $wizer_getting_func_index
        i32.eqz
        br_if 0
        i32.const <this function's local index>
        global.set $wizer_func_index
        unreachable
      end
      
  • then, during snapshotting, to get a given funcref's local function index, we set the $wizer_getting_func_index global non-zero, call the function, and then it will set its local function index to the $wizer_func_index global and trap.
  • the dummy functions we create for imports will need a similar dance, but implemented in native code rather than Wasm. Something similar for wasi functions too.

The one problem is that local function index isn't quite enough in the face of module linking. Instead we will need both the instance "id" (whatever that this; DFS index?) as well as the local function index in that instance. More to think about w.r.t. module linking here...

主要言語
Rust
スター
1.1k
フォーク
64
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

bytecodealliance/wizer のほかの issue

bytecodealliance/wizer の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。