You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm guessing that, though the text strings are identical, the float bits don't line up. I think you can confirm by changing the float case of values.ml:string_of_value to return Int64.to_string (Int64.of_float z).
I compared the disassembled code of the windows-version of main.native with the linux-version and noticed, that windows only makes use of fpu commands, while linux uses SSE-like commands. Could this make the difference?
There are ways that using x87 (fpu) instructions instead of SSE instructions can causes differences, but in the testcase here, all the values are small whole integers, so we ought to get the same answer regardless of which floating point unit is used.
I'm running the 32-bit ocaml build on Windows that the ml-prototype README recommends. Before this change, I see the same thing as @kg. With that change, I get a segfault running either the unaligned or cast assert_eqs in memory.wasm. I narrowed it down to something triggered by using the result of a f64.load. Some testing shows that it can evaluate this without crashing:
Activity
lukewagner commentedon Sep 8, 2015
I'm guessing that, though the text strings are identical, the float bits don't line up. I think you can confirm by changing the float case of values.ml:string_of_value to return
Int64.to_string (Int64.of_float z).kg commentedon Sep 8, 2015
Int64.to_string (Int64.of_float z)just prints '42'.lukewagner commentedon Sep 8, 2015
Oops, I meant
Int64.bits_of_float, notInt64.of_float.kg commentedon Sep 8, 2015
Yeah, that's the problem:
I'm not sure what to do about this. Does this indicate that our implementation is actually incorrect, at least on this os/arch combination?
kg commentedon Sep 8, 2015
Also fails:
pjuftring commentedon Sep 14, 2015
I compared the disassembled code of the windows-version of main.native with the linux-version and noticed, that windows only makes use of fpu commands, while linux uses SSE-like commands. Could this make the difference?
kg commentedon Sep 14, 2015
x87 vs SSE was my guess as well. I guess wasm on windows is doing 80-bit arithmetic and truncating, then?
sunfishcode commentedon Sep 14, 2015
There are ways that using x87 (fpu) instructions instead of SSE instructions can causes differences, but in the testcase here, all the values are small whole integers, so we ought to get the same answer regardless of which floating point unit is used.
sunfishcode commentedon Sep 15, 2015
@kg Would you mind trying a few more experiments:
castfunction to replace the last two stores with a single store of 4631107791820423168 to address 9 directlycastfunction to(f64.const 42.0)instead of doing a loadcastfunction to(f64.convert_s/i32 (i32.const 42))kg commentedon Sep 15, 2015
Sure thing, I'll try all that the next time I'm at home.
AndrewScheidecker commentedon Sep 22, 2015
I'm running the 32-bit ocaml build on Windows that the ml-prototype README recommends. Before this change, I see the same thing as @kg. With that change, I get a segfault running either the unaligned or cast assert_eqs in memory.wasm. I narrowed it down to something triggered by using the result of a
f64.load. Some testing shows that it can evaluate this without crashing:But either of these operations will cause a segfault:
I am highly suspicious of the Obj.magic in the memory module.
maurer commentedon Sep 22, 2015
It may be possible to use
Genarray.map_fileto produce differently typed views of the same memory without usingObj.magic.I would expect this would prevent the unusual segfault behavior that people are seeing.
Update some links (WebAssembly#52)
[spec] New instructions (WebAssembly#52)
[BoS] Add detailed typing rules for instructions (WebAssembly#52)
Update overview to include table64 (#52)
Update repos (WebAssembly#52)