[LLVMdev] Suggestion for VM porting to LLVM

Jon Harrop jon at ffconsultancy.com
Sun Apr 5 00:56:31 PDT 2009

On Sunday 05 April 2009 08:31:37 Gabriele Farina wrote:
> Hi Jon,
> I've read your articles about HLVM, and that was one of the reasons
> that convinced me to try out LLVM. Actually my VM has been implemented
> in C++, but as long as it is not extremely complex, I might port it to
> OCaml that sounds more compact for this kind of programs. Did you find
> any significant performance loss when using OCaml over C++ ? Runtime
> performance is quite important in my situation.

I have not benchmarked it because I have no C++ alternative but OCaml is 
generally several times faster than C++ at symbolic processing (like 

The main disadvantage of using OCaml is that the bindings are incomplete. 
However, they are almost complete and you can easily augment them with 
anything that you need. See the "llvm.cpp" and "llvm_stubs.c" files in HLVM, 
for example. I also had to work around some bugs in the LLVM bindings when 
building HLVM but I'll happily talk you through it.

I'm sure you'll have something suitably spectacular in a short time. :-)

Dr Jon Harrop, Flying Frog Consultancy Ltd.

More information about the llvm-dev mailing list