Stream: general

Topic: cranelift to wasm


view this post on Zulip Diego Antonio Rosario Palomino (Sep 25 2023 at 03:04):

Hello, i am interested i writing a functional compiler bac end for a functional language. I have been thining of targetting llvm but cranelift may be an easier to use alternative. One of my main questions Is whether cranelift can Targets wasm like llvm can

view this post on Zulip Afonso Bordado (Sep 25 2023 at 13:03):

Hey, currently cranelift only supports 4 targets, x86, AArch64, S390X and RISC-V. Adding a WebAssembly backend has been brought up before in this issue: https://github.com/bytecodealliance/wasmtime/issues/2566

Feature Add a Cranelift backend that compiles to Webassembly. Benefit This would allow a compiler to run in the browser and compile code to run in the browser. Implementation No plan yet Alternativ...

view this post on Zulip Diego Antonio Rosario Palomino (Sep 25 2023 at 15:04):

I see, so it could be done, but it has Yet to be implemented. Is there anything in the cranelift ir that would make it not an ideal Fit to Target wasm?
I have seem other SSA ir that Targets wasm so i hope it Is as well:
https://github.com/GetFirefly/firefly

An alternative BEAM implementation, designed for WebAssembly - GitHub - GetFirefly/firefly: An alternative BEAM implementation, designed for WebAssembly

view this post on Zulip Afonso Bordado (Sep 25 2023 at 15:21):

I'm not entirely sure if there's anything cranelift specific that makes it worse, @Chris Fallin has a good summary on the topic in this comment.

Feature Add a Cranelift backend that compiles to Webassembly. Benefit This would allow a compiler to run in the browser and compile code to run in the browser. Implementation No plan yet Alternativ...

view this post on Zulip Diego Antonio Rosario Palomino (Sep 25 2023 at 21:12):

Thanks. That comment links to a very useful project

view this post on Zulip Diego Antonio Rosario Palomino (Sep 25 2023 at 21:22):

I have been talking with the Gerbil/ Gambit scheme developers and the lead developer of Gambit says he would rather target web assembly directly as another IR could limit the performance of the generated code and the Gambit Bytecode Machine already does relooping of sorts to target other languages and is already an stack machine

view this post on Zulip Diego Antonio Rosario Palomino (Sep 25 2023 at 21:27):

I am checking the Gambit Bytecode Machine to see whether its actually similar to wasm and cranelift to see if using it would add a performance penalty.

Would rather use cranelift ( or a similar alternative ) to gain more native backends, low level optimizations and the ability to define custom calling conventions

view this post on Zulip Diego Antonio Rosario Palomino (Sep 25 2023 at 21:28):

Redox os developers say faster context switching could be achieved by using a non standard system call ABI


Last updated: Nov 22 2024 at 16:03 UTC