On Fri, Dec 16, 2022 at 2:46 PM Steve Dekorte <st...@dekorte.com> wrote:
> > How about adding an API like: > > Emscripten_extendStackIfNeeded(callback), which could be inserted anywhere > stack depth might be an issue and would launch another coroutine if the > stack was almost used up, swap to it, and swap back on return or exception? > Interesting, auto-magic, segmented and growable stacks. I don't know of any platform that does this, but it is an interesting idea. I think it could be a lot harder than at first glance. The biggest problem is that I think it would involve injecting checks everywhere in the wasm binary where SP is set and everywhere it gets restored. Each of those locations would likely also need some kind of extra local state (e.g. previous segment pointer). So maybe not impossible, but certainly not easy or free of runtime code. Luckily, since the execution stack is completely separate and managed by the VM I don't think it would need to involve any kind of coroutine or control flow primitive. > On Tuesday, May 18, 2021 at 1:21:01 PM UTC-7 s...@google.com wrote: > >> I have an open PR to reduce the default stack size in emscripten from 5Mb >> to 1Mb, and we are also considering reducing it even furthur (possibly to >> 64Kb which is the wasm-ld default, or to 128Kb, which is the musl default): >> https://github.com/emscripten-core/emscripten/pull/14177. >> >> How many folks out there have run into stack limits with the current >> limit of 5Mb? How many folks are worried they would run into limits if we >> reduce the default to 1Mb, 128Kb or 64Kb? Would those who feel they need >> more stack be OK adding `-sTOTAL_STACK` to their link command to request a >> higher limit? (feel free to respond there, or on the issue above). >> >> cheers, >> sam >> > -- > 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 emscripten-discuss+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/emscripten-discuss/4444d68e-5d77-448c-9e97-2cf11e8f0e09n%40googlegroups.com > <https://groups.google.com/d/msgid/emscripten-discuss/4444d68e-5d77-448c-9e97-2cf11e8f0e09n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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 emscripten-discuss+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/CAL_va2_%3DSC7ZgSBuWHMbh5Qa1JKUSkXTc2RF2sFxVt2d6MvxeQ%40mail.gmail.com.