Stack is optional. If you are targeting Wasm directly, you do not need to have a stack at all if your language domain does not need it. What Emscripten does with the stack is it blocks out a linear chunk of memory at startup and calls that the stack, and whenever compiled code does things like takes the address of a local variable, it must be pushed to the WebAssembly Memory out from a Wasm function local, so that it can be referenced by a pointer in other functions. WebAssembly itself does not care about Emscripten's STACKTOP etc., but all it operates on are the get_local and set_local type of opcodes for function local data.
2017-08-14 17:18 GMT+03:00 <[email protected]>: > Hi, > > We are compiling to wasm code from our Faust DSP compiler (so producing our > own wasm modules). > > In our wasm code, it is not clear yet how we could possibly define stack > allocated arrays. Compiling a C++ code example, I see that Emscripten > runtime code has some stack operations (like > stackSave/stackAlloc/stackRestore...) and generates stack related code in > the function header. So I understand that Emscripten runtime allocates a > block of memory to be used for the stack yes?, but what to do in if we don't > interact with the Emscripten runtime? Do we need to manage our own stack in > a similar way as Emscripten runtime does? Or are they any simpler > recommended way? > > Thanks. > > Stéphane Letz > > -- > You received this message because you are subscribed to the Google Groups > "emscripten-discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
