Search code examples
llvmbytecoderubinius

Can I generate LLVM bytecode with Rubinius and run it with lli?


I've tried running rbx compile but I am not quite sure what to do with the output. I would like to run it with lli, but I get the following error.

$ lli hello.rbc
lli: hello.rbc:2:1: error: expected '=' here
18185007515559028006
^

Solution

  • You don't run Rubinius byte-compiled code with lli because the .rbc file isn't an LLVM executable. Instead, you run it with a special Rubinius method call that handles pre-compiled bytecode for the Rubinius virtual machine. For example:

    rbx -I. -e "Rubinius::CodeLoader.require_compiled 'hello'"
    

    See Running Ruby With No Ruby for more details.