Why is there not a jump_indirect
instruction, similar to call_indirect
? How do I currently generate something like jmp *%rax
?
What do you want to use it for? Do you want a tail call, or a switch?
Tail call
I'm guessing this is not easily possible today: https://github.com/bytecodealliance/wasmtime/issues/1065
Just to make sure I'm not missing something: it's really not possible today to do an indirect jump in cranelift, right? The x64 I want to generate is something like jmp *%rax
.
Yes, it is currently not possible. There is no instruction for it, nor does regalloc have any support for it.
Thank you.
I'm curious, is this really not needed all that much in general? Or maybe the main user is wasmtime and it's not needed there?
So far none of the users required tail calls. WASM doesn't support it, C and Rust don't require it. Only some functional languages guarantee tail call optimization.
Though note that a tails calls proposal is at stage 3 in the standardization process, which means it's ready for implementation
Last updated: Dec 23 2024 at 12:05 UTC