2 ms·
If I compile a C or Rust program to run in GraalVM, will the LLVM bitcode be converted to some sort of universal bytecode, or does Graal attempt to run the bitc
by flohofwoe 4y ago
If I compile a C or Rust program to run in GraalVM, will the LLVM bitcode be converted to some sort of universal bytecode, or does Graal attempt to run the bitcode directly via a plugin? (e.g. do I distribute GraalVM bytecode or LLVM bitcode to the user?).
The documentation is a bit unclear about this, but there's this weird blurb at the end:
> Note: LLVM bitcode is platform-dependent. The program must be compiled to bitcode for an appropriate platform.
...why would this detail even matter if LLVM bitcode is converted to 'GraalVM bytecode'? In any case, it doesn't sound much like "write once run everywhere" ;)
See: https://www.graalvm.org/22.2/reference-manual/llvm/ https://www.graalvm.org/22.2/reference-manual/llvm/
- kaba0 4y agoGraal’s truffle runtime works basically as an AST interpreter, so you have to ship the LLVM bitcode. I have yet to get my feet wet with sulong, but my guess would be that LLVM will produce different bitcode on different platforms, and thus the execution can potentially be different - also note that llvm bitcode is not a stable format. But I don’t think that interpreting it on a different platform than it was compiled on would have a fundamental reason not to work (after all, it is just java code) - perhaps it uses the platform llvm libs for some parsing, which is not platform-agnostic?