Stream: git-wasmtime

Topic: wasmtime / issue #1065 Implement support tail calls in Wa...


view this post on Zulip Wasmtime GitHub notifications bot (Apr 21 2023 at 19:04):

fitzgen edited issue #1065 (assigned to fitzgen):

To write a functional language compiler using this IR, tail call eliminations would be desirable. Are there any plans to support this? I couldn't find any details in the docs.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 06 2023 at 22:38):

fitzgen commented on issue #1065:

So @jameysharp and I did a little profiling/investigation of switching the internal Wasm calling convention over to tail on our sightglass benchmarks. I was really expecting this to have no measurable change, but unfortunately it looks like it has a ~7% overhead on bz2 and spidermonkey.wasm and ~1% overhead on pulldown-cmark. This is surprising! We think this means that we ~frequently call functions that don't have enough register pressure to clobber all callee-save registers, and since tail only has caller-save registers and zero callee-save registers, we are doing more spills than we used to. Enough more that it is really measurable.

Supporting caller-save registers with the tail calling convention is possible, but requires more work. Either we do parallel moves (and also avoid building the temporary stack frames for tail calls with stack arguments) or we add a bunch of fiddly offset computation for tail calls. Both possible, but I don't want to do either right this very moment. I'd really like to get a wasmtime::Config knob for Wasm tail calls shipping first.

So here is our updated plan:

Additionally, we would not enable tail calls by default in Wasmtime until the performance issues are addressed.


Last updated: Oct 23 2024 at 20:03 UTC