Add optional support for wasm tail-call extension in wasm backend
Currently, the wasm backend uses the trampoline instead of the wasm tail-call extension for control flow transfer between cmm functions. We shouldn't use tail-call extension by default before it's supported by default in all major engines, but before then, it'd be useful to add optional support for it, and even produce artifacts for tail-call variants in manual/nightly CI.
Note that this requires changing definition of WasmReturnTop
. Previously we would emit the cmm callee function pointer on the wasm value stack, followed by a return
opcode represented by WasmReturnTop
. But now, for direct calls (callee is a known symbol), we should emit something like return_call xxx_entry
, which suggests WasmReturnTop
should contain the callee field. It's possible but pretty awkward to pattern-match on WasmSeq callee WasmReturnTop
. Thoughts? @nrnrnr