hey folks, I've been researching and studying some lower level concepts getting into compilers and languages (starting with SICP and working through "Build your own Lisp") and have also been reading up on/watching talks on LLVM.
I've been tangentially aware of WASM, but just recently started diving into the Bytecode Alliance stuff and have been scrolling around on the Github org.
getting to the point: as a hobby project I'm working on a scheme-ish language (mandatory "I know, another scheme/lisp") and have been exploring options for implementation details after ironing out parts of a spec. LLVM comes highly recommended, but is a fairly complex beast (and interop seems to require a complex FFI).
Curious on people's thoughts for targeting Cranelift IR, and using the bytecode alliance ecosystem for my project? TL;DR for what I'm looking for is portability, not having to implement a runtime (looks like wasmtime for JIT and lancet for AOT?), potentially interop with other code (so, wasm modules?), and the ability to embed the compiler and runtime into a single binary (which, given these are all just crates, a single rust executable can contain all of this). I'd love to get involved in a younger project and ecosystem, having had very little opportunities to contribute to OS, this seems like a place I could find myself growing into being useful with the projects :)
I see things like tail-call optimizations on the roadmap, and same with threads/continuations which is exciting.
Wasmtime and lucet are both for WebAssembly. Cranelift is the actual codegen component of both, taking a similar role to LLVM. If you are not targeting WASM you should directly use Cranelift. cranelift-simplejit provides a JIT, while cranelift-object provides the ability to emit object files. To generate cranelift ir, you should probably use cranelift-frontend.
Threads are supported by Cranelift itself. Since recently there are instructions for atomic operations. (the only work with the new x64 and aarch64 backend, not the old x86 backend that can also emit x86_64 code) Continuations can be implemented outside of the codegen backend. Tail-call optimization requires an abi that supports it as far as I know.
Last updated: Nov 22 2024 at 17:03 UTC