Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebAssembly Spec compliance for instructions #16

Open
binji opened this issue Oct 11, 2018 · 0 comments
Open

WebAssembly Spec compliance for instructions #16

binji opened this issue Oct 11, 2018 · 0 comments

Comments

@binji
Copy link

binji commented Oct 11, 2018

Hi, I just saw your project on WasmWeekly! I worked on something similar here, and there's a wasm-to-rust converter here too that you may be interested in.

One thing I noticed is that you aren't currently handling traps. It will be hard to pass the WebAssembly spec testsuite without those.

There are some instructions that have subtle behaviors as well; in particular, most of the floating point instructions map to C instructions or math functions, but min/max have different behavior with NaNs. I've also found that MSVC on 64-bit architectures will be slightly off for some values on the uint64-to-float and uint64-to-double conversions. Another thing to watch out for: WebAssembly doesn't work properly with x87 floating point instructions, and requires SSE2 instructions instead. This mostly only becomes an issue on MSVC for 32-bit architectures where the calling convention still may pass floating point values using x87 registers even when you enable SSE2. You can use the __vectorcall calling convention to work around that.

The spec tests will cover most of these behaviors. They're written using the .wast testing format, including assertions and multiple modules. You can use wabt's wast2json tool to convert them to a single JSON file of assertions with a .wasm files for each module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant