Stream: wasm

Topic: wasmparser and streaming parsing/validation


view this post on Zulip Alex Crichton (Jul 06 2020 at 20:47):

@Yury Delendik as a heads up, this is a simple sketch of what I'm thinking for wasmparser -- https://gist.github.com/alexcrichton/5cd36abd7bef3b57e4dd4033c7c3345b

GitHub Gist: instantly share code, notes, and snippets.

view this post on Zulip Alex Crichton (Jul 06 2020 at 20:48):

the high-level idea is to remove ModuleReader, Parser, and ValidatingParser. The first two would be replaced by the Parser in that gist, and the latter would be replaced by Validator

view this post on Zulip Alex Crichton (Jul 06 2020 at 20:48):

and at the same time we'd make Parser amenable to incremental parsing (data fed over time), and the validator would be optionally used to feed data into

view this post on Zulip Alex Crichton (Jul 06 2020 at 20:48):

so validation is on/off based on whether you use Validator

view this post on Zulip Alex Crichton (Jul 06 2020 at 20:49):

overall it should ideally be easier to manage because there's less of a state machine and more "it's just straight-line code"

view this post on Zulip Alex Crichton (Jul 06 2020 at 20:50):

oh the other goal is to enable parallel validation and to be able to reuse the results from validation

view this post on Zulip Alex Crichton (Jul 06 2020 at 20:50):

so we could, for example, hook up validation directly into cranelift

view this post on Zulip Alex Crichton (Jul 06 2020 at 20:50):

this'll be needed to implement module linking because a call to a function is somewhat nontrivial to figure out the signature of that call

view this post on Zulip Alex Crichton (Jul 06 2020 at 20:50):

or, really any type information becomes nontrivial due to aliasing

view this post on Zulip Alex Crichton (Jul 06 2020 at 20:51):

these are my changes so far (basically just implementing Parser) -- https://github.com/bytecodealliance/wasm-tools/compare/main...alexcrichton:incremental-parser

Low level tooling for WebAssembly in Rust. Contribute to bytecodealliance/wasm-tools development by creating an account on GitHub.

view this post on Zulip Yury Delendik (Jul 06 2020 at 20:54):

Cool, I need to think about this more. Though it looks similar to what I used in the past -- https://github.com/wasdk/wasmparser/blob/master/src/WasmParser.ts#L1486

Simple streamable WebAssembly binary parser. Contribute to wasdk/wasmparser development by creating an account on GitHub.

view this post on Zulip Yury Delendik (Jul 06 2020 at 20:58):

It will work


Last updated: Dec 23 2024 at 12:05 UTC