Stream: git-wasmtime

Topic: wasmtime / issue #4020 Question: Cranelift Self Compilation


view this post on Zulip Wasmtime GitHub notifications bot (Apr 13 2022 at 02:59):

jeff-hykin opened issue #4020:

For many years now I've been eargerly waiting for a language that can compile it's own compiler to wasm/wasi. I've talked with the guy who made the llvm to wasm demo (sadly that project has quickly been going nowhere). I've talked to some rust groups about compiling a minimal subset of a rust compiler to wasm. I've talked with some people from V-lang, etc.

So my question is, how unrealistic is it for cranelift to compile itself to wasm (a module function with IR input and wasm-bytes output)? "Unrealistic" as-in; is there unavoidable multithreading, or raw assembly, etc in cranelift that would be a show-stopper for compiling it to WASM.

Thanks!

view this post on Zulip Wasmtime GitHub notifications bot (Apr 13 2022 at 02:59):

jeff-hykin edited issue #4020:

For many years now I've been eargerly waiting/searching for a language that can compile it's own compiler to wasm/wasi. I've talked with the guy who made the llvm to wasm demo (sadly that project has quickly been going nowhere). I've talked to some rust groups about compiling a minimal subset of a rust compiler to wasm. I've talked with some people from V-lang, etc.

So my question is, how unrealistic is it for cranelift to compile itself to wasm (a module function with IR input and wasm-bytes output)? "Unrealistic" as-in; is there unavoidable multithreading, or raw assembly, etc in cranelift that would be a show-stopper for compiling it to WASM.

Thanks!

view this post on Zulip Wasmtime GitHub notifications bot (Apr 13 2022 at 03:00):

jeff-hykin edited issue #4020:

For many years now I've been eargerly waiting/searching for a language that can compile it's own compiler to wasm/wasi. I've talked with the guy who made the llvm to wasm demo (sadly that project has quickly been going nowhere). I've talked to some rust groups about compiling a minimal subset of a rust compiler to wasm. I've talked with some people from V-lang, etc.

So my question is, how unrealistic is it for cranelift to compile itself to wasm (a module function with IR input and wasm-bytes output)? "How unrealistic" as-in; is there unavoidable multithreading, or raw assembly, etc in cranelift that would be a show-stopper for compiling it to WASM.

Thanks!

view this post on Zulip Wasmtime GitHub notifications bot (Apr 13 2022 at 03:01):

jeff-hykin edited issue #4020:

For many years now I've been eargerly waiting/searching for a language that can compile it's own compiler to wasm/wasi. I've talked with the guy who made the llvm to wasm demo (sadly that project has quickly been going nowhere). I've talked to some rust groups about compiling a minimal subset of a rust compiler to wasm. I've talked with some people from V-lang, etc.

So my question is, how unrealistic is it for cranelift to compile itself to wasm (a module function with IR input and wasm-bytes output)? "How unrealistic" as-in; does cranelift have unavoidable multithreading, or raw assembly, etc that would be a show-stopper for compiling it to WASM.

Thanks!

view this post on Zulip Wasmtime GitHub notifications bot (Apr 13 2022 at 03:37):

cfallin commented on issue #4020:

Hi @jeff-hykin -- this use-case would mainly depend on support for generating Wasm bytecode, which we previously discussed a bit in #2566. I think that while it's not totally unrealistic, it's a major undertaking: Wasm as an ISA is very different from our current target architectures in several important ways (stack machine, unlimited "registers" (locals) hence maybe no or only simple regalloc, functions are a first-class machine feature rather than software-managed via stack conventions, structured control flow, etc). I'd encourage you to read over that thread for ideas and background.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 13 2022 at 03:46):

jeff-hykin commented on issue #4020:

Oh I'm actually embarrassed to admit I didn't realize WASM/WASI wasn't a cranelift backend. And I was just reading the internals of the IR last week :sweat_smile: Thanks for the pointer to that thread. That'll certainly resolve this issue for now.

I suppose I just associated wasmtime/bytecode-alliance/cranelift so much I had just always assumed WASM was a cranelift backend.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 13 2022 at 03:46):

jeff-hykin closed issue #4020:

For many years now I've been eargerly waiting/searching for a language that can compile it's own compiler to wasm/wasi. I've talked with the guy who made the llvm to wasm demo (sadly that project has quickly been going nowhere). I've talked to some rust groups about compiling a minimal subset of a rust compiler to wasm. I've talked with some people from V-lang, etc.

So my question is, how unrealistic is it for cranelift to compile itself to wasm (a module function with IR input and wasm-bytes output)? "How unrealistic" as-in; does cranelift have unavoidable multithreading, or raw assembly, etc that would be a show-stopper for compiling it to WASM.

Thanks!


Last updated: Dec 23 2024 at 12:05 UTC