Add support for snapshotting tables
还没有人认领这个 Issue。
评估
调研方向
首先跟踪 issue 中描述的 Wizer instrumentation 和 snapshotting 路径;其中没有指定文件或测试。确定如何表示跨链接实例的 funcref 标识,以及如何处理导入函数和 WASI 函数,同时保持 externref 的初始化行为不变。完成标准是两种 table 类型都可以进行 snapshot,并覆盖 module-linking 的情况。
由索引模型根据 Issue 内容生成。
描述
Right now there are two potential kinds of tables:
funcreftablesexternreftables
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_indexand$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
- add two new globals to the module:
- then, during snapshotting, to get a given
funcref's local function index, we set the$wizer_getting_func_indexglobal non-zero, call the function, and then it will set its local function index to the$wizer_func_indexglobal 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
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
bytecodealliance/wizer 的其他 Issue
-
Broken link (2021 WebAssembly Summit)可能重新可做 关联的 PR 已关闭且未合并。 未关闭
难度 1/5 1 小时以内 新手友好度 72/100
bytecodealliance/wizer#130 ·
-
难度 5/5 一周以上 新手友好度 30/100
bytecodealliance/wizer#153 · 1 条评论 ·
-
难度 4/5 3-5 天 新手友好度 35/100
bytecodealliance/wizer#126 ·
-
难度 4/5 3-5 天 新手友好度 25/100
bytecodealliance/wizer#125 · 1 条评论 ·
-
难度 3/5 1-2 天 新手友好度 32/100
bytecodealliance/wizer#105 · 1 条评论 ·
查看 bytecodealliance/wizer 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
swc-project/swc#12576 ·
维护者通常 1 天内回复
-
good first issue gpu serve
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 80/100
维护者通常 1 天内回复