Run LLVM Bitcode with GraalVM Enterprise
Oracle GraalVM Enterprise Edition ships with the LLVM runtime. It provides an implementation of the
lli tool to directly execute programs from LLVM bitcode.
The LLVM runtime is written in Java on top of the Truffle Language Implementation framework and uses the GraalVM dynamic compiler.
You can execute C/C++, Rust and any programming language that can be compiled to LLVM bitcode by the LLVM front end such as
Note: LLVM bitcode is platform dependent. The program must be compiled to bitcode for the appropriate platform.
To run programs in LLVM bitcode format:
lli [LLI option] filename.bc [program args]
Where filename.bc is a single program source file in LLVM bitcode format. Mandatory arguments to long options are mandatory for short options too.
GraalVM and Polyglot options are to be placed after LLI options, but before the bitcode file name:
lli [LLI Options] [GraalVM Options] [Polyglot Options] filename.bc [program args]
|-L /–-llvm.libraryPath=||Add a list of paths where GraalVM will search for library dependencies. Paths are delimited by
|–-lib /–-llvm.libraries=||Add a list of libraries to load. The list can contain precompiled native libraries (.so/.dylib) and bitcode libraries (.bc). Files with a relative path are looked up relative to
|–-llvm.libraries=||List of libraries (precompiled libraries .dylib/.so as well as bitcode libraries .bc). Files with a relative path will be looked up relative to
|–-llvm.libraryPath=||A list of paths where the LLVM runtime will search for relative libraries. Paths are delimited by
|–-llvm.managed||Enable an experimental managed mode, which means memory allocations from LLVM bitcode are done on the managed heap.|
|–-llvm.stackSize=||The stack size, please end the input with one of: k, m, g, or t. Note: the stack size will be in bytes if no appropriate suffix is given.|
|–-jvm||Execute an application in the JVM mode.|
|–-vm.<option>||Pass JVM options to GraalVM. List available JVM options with
|–-vm.Dgraal.<option>||Pass settings to the GraalVM compiler. For example,
|–-engine.Mode=default||Configure the execution mode of the engine. The execution mode automatically tunes the polyglot engine towards latency or throughput.
|–-engine.CompilerConfiguration=name||Select the GraalVM compiler configuration to use for polyglot application code. If omitted, the compiler configuration with the highest auto-selection priority is used. To see the set of available configurations, supply the value help to this option. The current configurations and their semantics are:
|–-engine.TraceCompilation=false||Print an informational line to the console for each completed compilation.|
|–-experimental-options||Unlock experimental features that are behind flags. For example, to use
|–-polyglot||Run with all other guest languages accessible.|
|--<languageID>.<property>=<value>||Pass properties to guest languages through the GraalVM Polyglot SDK.|
--<languageID>.<property>=<value> syntax is to allow any language launcher
to access the options of other GraalVM supported languages.
More information on supported languages, runtimes and examples can be found in the reference manual for LLVM Runtime.
Warning: If the option is entitled as experimental, it might never be included in a production version, or might change significantly before being considered production-ready.