Thomas Lively via llvm-dev
2021-Dec-15 17:53 UTC
[llvm-dev] WASM force stack slots for allocas
Hi Carlo, There's no scalable way to do this that I know of. Disabling mem2reg might do the trick, but I don't know how to do that without changing LLVM source. Another workaround might be to mark the relevant locals `volatile` in your source, but doing that for your entire code base is probably not practical. On the WebAssembly level, we have discussed adding the ability to do stack scanning in the past, but if we add that, it won't be any time soon. Best, Thomas On Wed, Dec 15, 2021 at 1:41 AM Carlo Kok via llvm-dev < llvm-dev at lists.llvm.org> wrote:> As far as I can tell llvm webassembly has two stacks; one is on the > javascript wasm stack and cannot be walked; the other one is in memory > before or after the datasegment and can be walked. > > I'm using the BoehmGC; which btw works really well except that it cannot > scan the wasm stack in any way that I can find thus causing it to free > things on the javascript/wasm stack. > > Is there a good solution for this, or otherwise a way to force some > allocas to stay alloca through the optimizer? Preferably without changing > llvm itself of course. > > I know about the wasm gc prpoosal, The wasm gc proposal is still in flux, > moves slowly and I can respect that; I however I am looking for a solution > that works in the shorter term. > > Thanks, > > Carlo Kok > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20211215/02ba865b/attachment.html>
Carlo Kok via llvm-dev
2021-Dec-15 18:25 UTC
[llvm-dev] WASM force stack slots for allocas
Would a GC strategy with gc roots not do it? On Wed, Dec 15, 2021, at 18:53, Thomas Lively wrote:> Hi Carlo, > > There's no scalable way to do this that I know of. Disabling mem2reg might do the trick, but I don't know how to do that without changing LLVM source. Another workaround might be to mark the relevant locals `volatile` in your source, but doing that for your entire code base is probably not practical. On the WebAssembly level, we have discussed adding the ability to do stack scanning in the past, but if we add that, it won't be any time soon. > > Best, > > Thomas > > On Wed, Dec 15, 2021 at 1:41 AM Carlo Kok via llvm-dev <llvm-dev at lists.llvm.org> wrote: >> As far as I can tell llvm webassembly has two stacks; one is on the javascript wasm stack and cannot be walked; the other one is in memory before or after the datasegment and can be walked. >> >> I'm using the BoehmGC; which btw works really well except that it cannot scan the wasm stack in any way that I can find thus causing it to free things on the javascript/wasm stack. >> >> Is there a good solution for this, or otherwise a way to force some allocas to stay alloca through the optimizer? Preferably without changing llvm itself of course. >> >> I know about the wasm gc prpoosal, The wasm gc proposal is still in flux, moves slowly and I can respect that; I however I am looking for a solution that works in the shorter term. >> >> Thanks, >> >> Carlo Kok >> _______________________________________________ >> LLVM Developers mailing list >> llvm-dev at lists.llvm.org >> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20211215/942f08a7/attachment.html>