Stream: cranelift

Topic: jump_indirect instruction?


view this post on Zulip osa1 (May 16 2020 at 19:00):

Why is there not a jump_indirect instruction, similar to call_indirect? How do I currently generate something like jmp *%rax?

view this post on Zulip bjorn3 (May 16 2020 at 20:41):

What do you want to use it for? Do you want a tail call, or a switch?

view this post on Zulip osa1 (May 16 2020 at 20:42):

Tail call

view this post on Zulip osa1 (May 16 2020 at 21:11):

I'm guessing this is not easily possible today: https://github.com/bytecodealliance/wasmtime/issues/1065

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 osa1 (May 24 2020 at 08:47):

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.

view this post on Zulip bjorn3 (May 24 2020 at 10:06):

Yes, it is currently not possible. There is no instruction for it, nor does regalloc have any support for it.

view this post on Zulip osa1 (May 24 2020 at 10:07):

Thank you.

view this post on Zulip osa1 (May 24 2020 at 10:07):

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?

view this post on Zulip bjorn3 (May 24 2020 at 10:10):

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.

view this post on Zulip Till Schneidereit (May 24 2020 at 13:59):

Though note that a tails calls proposal is at stage 3 in the standardization process, which means it's ready for implementation

Tracking WebAssembly proposals. Contribute to WebAssembly/proposals development by creating an account on GitHub.

Last updated: Nov 22 2024 at 16:03 UTC