Does anybody here have some experience with WebAssembly? If so, what do you think about it?
I have made a compiler for my programming language targeting WebAssembly, and ported some programs in my programming language to web using it: https://flatassembler.github.io/analogClock.html (https://flatassembler.github.io/analogClock.html)
One of the weirdest problems I've faced with when targeting WebAssembly is that WebAssembly doesn't allow you to call a function that returns something and simply do nothing with the result. x86 assembly (and I think most assembly languages) allows you to do stuff like that without problems, and it was hard for me to figure out what was going on.
Are you trying to read "eax" in 32 bit or "rax" in 64 bit as the return value ? Another common method is to pass the address of a variable or structure and write to it within the procedure you are calling.
Quote from: hutch-- on September 04, 2020, 05:14:02 AM
Another common method is to pass the address of a variable or structure and write to it within the procedure you are calling.
And, because all the thing is C++ based, that address is the first function argument.
Quote from: hutch-- on September 04, 2020, 05:14:02 AM
Are you trying to read "eax" in 32 bit or "rax" in 64 bit as the return value ? Another common method is to pass the address of a variable or structure and write to it within the procedure you are calling.
I mean, one of the biggest (and most confusing) differences between x86 Assembly and WebAssembly is that, in x86 Assembly, if you, immediately after calling one function that returns something in eax, call another function, x86 Assembly doesn't complain. WebAssembly, on the other hand, complains you didn't check the result in eax before calling that other function.
Then WebAssembly needs to adapt to how the processor hardware works. You can routinely call procedures that don't return any value at all and if it returns something in eax, it can routinely be ignored if you don't need the result.
This one could interest you
http://masm32.com/board/index.php?topic=8624.msg94306#msg94306 (http://masm32.com/board/index.php?topic=8624.msg94306#msg94306)