4 ms·
Thank you! That's an interesting question. godbolt supports webassembly as a target, so it is easy to check out what would be generated for given C or C++ The
by pacaro 5y ago
Thank you!
That's an interesting question. godbolt supports webassembly as a target, so it is easy to check out what would be generated for given C or C++
The big difference that I'm aware of is that I don't need to worry about the C model. The code that emscripten generates has to allow for all the things that can be done on the stack that wasm doesn't support directly, so it has to provide an area in memory that acts as a stack and manage that. The flipside of this is that I have no way to get a return value from a function that is more than an (i|f)(32|64), there are a couple of places where I pack 2 32-bit ints into a 64-bit int to return two pieces of data at the same time, this is inconvenient. WASM has a proposal for multiple return values, but I'm not sure how well supported it is. I couldn't get it to work with Node for example.