I really like the idea of lightbeam (fan of dynasmrt too). Is there (1) a documentation somewhere of why it became unmaintaneid and (2) last known good version? I'm looking for a semi-working starting point to hack from.
(1) the maintainer stopped working on it. but the basic idea of it still makes sense.
(2) I expect the current trunk is as good as any other revision. That said, the code is fairly complex, in part because it had ambitions of doing advanced optimizations on the fly, so if you want something simple (and a single-pass wasm jit can be fairly simple), it may be easier to start something new.
https://github.com/bytecodealliance/wasmtime/tree/main/crates/lightbeam looks like there is some type of rewrite / migration going on ... and quit halfway
Lightbeam was always in a state of migration; I don't recall a time when it really settled in.
I had worked on a paper involving wasm baseline compiler so I have investigated this a bit. I have actually bisected the git history, and my conclusion is that such "good version" never existed: (1) lightbeam never supported br_table. You will hit this wasm instruction if your source code has anything like a function pointer or virtual methods, so you will get an unsupported error for basically any real-world module. (2) I have hit another error saying "virtual registers have run out", so it seems like lightbeam is making unreasonable assumptions on the size/complexity of input code as well.
@Haoran Xu : Thank you for sharing the insightful experience. I am still trying to get Lightbeam to exeucte \ x y -> x + y applied to (5_u32, 3_u32). One thing I do like about Lighteam is I am fasicnated by the idea of wasm -> dynasm without involving LLVM / Cranelift. For your paper, did you end up sticking with Lighteam or dod you go with wasmer-singlepass (which I believe also does wasm -> dynasm).
I wrote my own baseline compiler so lightbeam/wasmer singlepass (and those from web browsers) are my benchmark rivals. The paper is still moving through the conf reviewing process, but if you are interested in productionzing my baseline compiler (currently supporting wasm 1.0 spec but nothing more) feel free to PM me.
I have been refactoring lightbeam. I got the following to work:
(i32.const 42)
(i32.const 20) (i32.const 22) i32.add
It seems that when passing parameters to lightbeam, it can't read the args properly (i.e. passing (5, 3) it gets (5, some gigantic large number)). This looks like a calling convention problem. I am going to hack on lightbeam a bit more, still hopeful there is an interesting core to refactor out of it.
Last updated: Dec 23 2024 at 12:05 UTC