WebAssembly/wasi-sdk

Stack growing support

veluca93 opened this issue · 3 comments

(perhaps this issue is better opened on the main LLVM repo)

Is it possible to support unbounded/growing stacks?

Some code makes heavy use of recursion, and having a fixed stack size is quite limiting. I had originally thought that the multiple memories proposal would help there, but that would introduce different types of pointers, which sounds like a terrible idea :-)

It's theoretically possible. And yes, this would largely be an upstream LLVM feature, though depending on how it works, it may also need support from wasi-sdk/wasi-libc too.

Thanks for the quick reply :-)

Are you aware of any issues/plans regarding this feature? Or even any existing implementation plans/ideas...

I'm not aware of any plans.

If you want to be sure that all code dynamically allocates more stack space instead of assuming it has enough, it seems likely that this will require adding a new ABI, a separate wasi-libc build, and thus a new wasi-sdk target.

Another potential consideration is that when wasi-libc adds setjmp support, it will need to be aware of any dynamically-allocated stack regions between the longjmp and the setjmp.