3 ms·
> I don't know what (if any) performance boost the VM would get by being converted to LLVM IR Well you can already convert the VM to LLVM IR today by compiling
by chrisseaton 10y ago
> I don't know what (if any) performance boost the VM would get by being converted to LLVM IR
Well you can already convert the VM to LLVM IR today by compiling with clang.
- valarauca1 10y agoThis is an interesting idea. If you transpile the Ruby runtime to LLVM-IR you can run Ruby's IR in LLVM's tracing JIT mode. Theoretically the LLVM will optimize your application as its running. P.S.: I don't know Ruby so YMMV P.P.S.: If it works with Ruby it'll work with Python too.
- chrisseaton 10y agoWe do this to run Ruby C extensions on the JVM - compile the extension to LLVM IR instead of native code, then JIT compile the IR using the JVM's JIT. It's fast!
- chc 10y agoHuh? You use the JVM's JIT to compile LLVM IR? How does that work? Isn't it a bytecode compiler?
- chrisseaton 10y agoWell yes but at some point in the pipeline the byte code is long gone. So you can use it for anything by using just the parts beyond that point. But really we don't directly compile the IR. We have an interpreter for IR, and we JIT compile the interpreter, sort of constant folded with the IR. It achieves the same thing without getting more technical. https://github.com/graalvm/sulong https://github.com/graalvm/sulong