VmKit Question.


I compiled VmKit and got it running, but do not know how it is possible to emit llvm-bitcode fram .java code. Would you please help me?


Hi Saman,

The Release/bin/vmjc tool is the .class --> .bc compiler. It will compile .class files and .jar files to .bc files.

If you want to generate an executable with this .bc file, the process is more difficult. First you need to go to the tools/vmjc/libvmjc directory and type:

This should create a Release/lib/libvmjc.so file (assuming you're on Linux/x86, I'm having troubles with other archs), which contains the base classes (ie rt.jar) native representation (whose abi is vmkit specific). Now, to generate an executable, here's what you should do:

1) set LD_LIBRARY_PATH to the path containing the libvmjc.so
2) set PATH to contain the llvm binaries and the vmkit binaries
3) Use llcj with the same command line arguments than gcj, e.g: llcj --main=Test -O3 -o Test Test.class

This will be more documented at some point on the vmkit website, but with this info, you should be all set! And don't hesitate to ask if you're having trouble setting the compiler up.


Saman Aliari Zonouz wrote: