binaryen icon indicating copy to clipboard operation
binaryen copied to clipboard

[Question] How to do type evaluation in Binaryen?

Open hungryzzz opened this issue 10 months ago • 1 comments

Hi, I found that when I use WasmBinaryReader to parse a type-mismatched wasm file, it would not raise error messages. So I just wonder could I do the type evaluation in Binaryen? i.e., Simulate execution on an abstract stack to determine whether there is a type mismatch. Thank you!

(; example of type-mismatched code ;)
global.get 0
i32.const 32
i64.sub

hungryzzz avatar Apr 07 '24 07:04 hungryzzz

To check if the module is valid you also need to run validation,

https://github.com/WebAssembly/binaryen/blob/main/src/wasm-validator.h

kripken avatar Apr 07 '24 18:04 kripken