stack.h

The functions defined in<emscripten/stack.h> allow inspectinginformation about the WebAssembly data stack (sometimes called the“user stack” or the “C stack”). This data stack is the data containedwithin the linear memory (as opposed to the trusted call stack thatis managed by the VM, and which is not visible to the running program).

uintptr_temscripten_stack_get_base(void)

Returns the starting address of the stack. This is the addressthat the stack pointer would point to when no bytes are in use on thestack.

uintptr_temscripten_stack_get_end(void)

Returns the end address of the stack. This is the address thatthe stack pointer would point to when the whole stack is in use. (Theaddress pointed to by the end is not part of the stack itself). Notethat the stack grows down so the address returned byemscripten_stack_get_end() is smaller thanemscripten_stack_get_base().

voidemscripten_stack_set_limits(void*base,void*end)

Sets the internal values reported byemscripten_stack_get_base()andemscripten_stack_get_end(). This should only be used by lowlevel libraries such as asyncify fibers.

uintptr_temscripten_stack_get_current(void)

Returns the current stack pointer.

size_temscripten_stack_get_free(void)

Returns the number of free bytes left on the stack. This is requiredto be fast so that it can be called frequently.