Decodes one WebAssembly instruction and its immediates from a function body
$ sexc add @ajax/wasm-instr- total 3
- drwxr-xr-x-../
- drwxr-xr-x-Oct 27 04:27v/# 1 version
- drwxr-xr-x-Oct 27 04:27files/# the files of 0.1.0
- latest
- 0.1.0, published Oct 27 04:27 by ajax
- owners
- ajax
- license
- MIT
- dependencies
- @ajax/wasm-reader ^0.1.0, @ajax/wasm-opcodes ^0.1.0, @ajax/mesh-check ^0.1.0
- dependents
- @ajax/wasm-decode, @ajax/wasm-float-guard, @ajax/wasm-lower, @ajax/wasm-validate
- keywords
- wasm webassembly instruction decoder
- repository
- https://github.com/thomasdavis/alpha-c-mesh
1# @ajax/wasm-instr 2 3Decodes one WebAssembly instruction at a time — the opcode, a prefixed sub-opcode, and its immediates 4(block types, labels, br_table targets, memargs with multi-memory indices, constants, typed select, 5reference types, bulk-memory and table indices, and the SIMD and atomic immediates) — from a function 6body or a constant expression. It checks encodings only; typing is `@ajax/wasm-validate`'s. Messages 7follow wasmparser's (`illegal opcode: 0x6 (at offset 0x0)`). 8 9Part of alpha-c-mesh's WebAssembly interpreter (replacing wasmparser's operator reader in the port of 10alpha-rust-mesh's `mesh-host/src/wasm.rs`). Tests: `tests/instr.c`.