Stream: git-wasmtime

Topic: wasmtime / issue #12598 Implementing a custom target / ba...


view this post on Zulip Wasmtime GitHub notifications bot (Feb 15 2026 at 13:07):

espoal opened issue #12598:

I will start to admit that I'm a noob in the compiler topics, so I'm probably misunderstanding something fundamental.

Goal: I would like to implement a custom target using cranelift, which is a virtual machine very similar to WASM. Let's say for now that the source is Rust code.

My understanding: I think that to achieve this I would need to implement a custom backend / codegen module, while reusing the existing Rust frontend. I believe that the Rust-to-WASM pipeline is implemented this way, but this issue seems to contradict what I know.

Questions:

view this post on Zulip Wasmtime GitHub notifications bot (Feb 15 2026 at 13:08):

espoal edited issue #12598:

I will start to admit that I'm a noob in the compiler topic, so I'm probably misunderstanding something fundamental.

Goal: I would like to implement a custom target using cranelift, which is a virtual machine very similar to WASM. Let's say for now that the source is Rust code.

My understanding: I think that to achieve this I would need to implement a custom backend / codegen module, while reusing the existing Rust frontend. I believe that the Rust-to-WASM pipeline is implemented this way, but this issue seems to contradict what I know.

Questions:

view this post on Zulip Wasmtime GitHub notifications bot (Feb 15 2026 at 13:08):

espoal edited issue #12598:

I will start to admit that I'm a noob in the compiler topic, so I'm probably misunderstanding something fundamental.

Goal: I would like to implement a custom target using cranelift, which is a virtual machine very similar to WASM. Let's say for now that the source is Rust code.

My understanding: I think that to achieve this I would need to implement a custom backend / codegen module, while reusing the existing Rust frontend. I believe that the Rust-to-WASM pipeline is implemented this way, but this issue seems to contradict what I know.

Questions:

Thank you!

view this post on Zulip Wasmtime GitHub notifications bot (Feb 15 2026 at 13:18):

bjorn3 commented on issue #12598:

Rustc uses LLVM for compiling to wasm. No Cranelift or Wasmtime is involved with that at all. Only compiling the wasm to machine code uses Cranelift as compiler when using Wasmtime as wasm runtime. There is also rustc_codegen_cranelift for directly compiling rust code with Cranelift, but that doesn't allow producing wasm, rather it directly produces machine code. Only wasm -> cranelift ir is supported through Wasmtime, not cranelift ir -> wasm. Wasm is different enough from machine code that you can't reuse Cranelift backend framework at all. Cranelift expects to compile to a register machine (like almost all real hardware), while wasm is a stack machine.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 15 2026 at 13:36):

espoal commented on issue #12598:

Thanks @bjorn3 for the explanation. So from what I understood:

Makes sense now.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 15 2026 at 13:37):

espoal edited a comment on issue #12598:

Thanks @bjorn3 for the explanation. So from what I understood:

Makes sense now. If that's correct please answer with a thumb up, and I will consider this issue closed.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 15 2026 at 13:40):

espoal edited a comment on issue #12598:

Thanks @bjorn3 for the explanation. So from what I understood:

Makes sense now. If that's correct please react with a thumb up, and I will consider this issue closed.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 15 2026 at 13:46):

espoal closed issue #12598:

I will start to admit that I'm a noob in the compiler topic, so I'm probably misunderstanding something fundamental.

Goal: I would like to implement a custom target using cranelift, which is a virtual machine very similar to WASM. Let's say for now that the source is Rust code.

My understanding: I think that to achieve this I would need to implement a custom backend / codegen module, while reusing the existing Rust frontend. I believe that the Rust-to-WASM pipeline is implemented this way, but this issue seems to contradict what I know.

Questions:

Thank you!


Last updated: Feb 24 2026 at 04:36 UTC