[LLVMdev] Suggestion for VM porting to LLVM

Jon Harrop
Sat, 04 Apr 2009 17:46:14 -0000

On Saturday 04 April 2009 09:20:21 Gabriele Farina
wrote:
> - generate IR from my complier;
> - build a VM that converts at runtime my bytecode to IR and executes it;
>
> I largely prefer the second option because it would be great if I can
> continue to use to old programs without having to recompile them.
>
> Which approach do you suggest ? are there any alternatives ?

I've done something similar with HLVM, albeit for a new VM that uses a new
representation. I found the combination of OCaml and LLVM to work extremely
well. OCaml makes it very easy to manipulate programs and its LLVM bindings
make it very easy to JIT compile and execute native code. My entire VM
(including GC) is only 1kLOC.

--
Dr Jon Harrop, Flying Frog Consultancy Ltd.