Question

I'm looking for an open source virtual machine that's:

  • fast and as lightweight as possible
  • supports a minimal set of bytecode (like LLVM IR)
  • easily embedable from a C++ application
  • Cross platform (Linux, Windows and OS X)
  • x86 support
Was it helpful?

Solution

Why filter out LLVM ? It's a set of C libraries

I guess it's not as easy to embed than Lua, but LLVM is so great that it would probably overcome the hassle of integrating it. See this SO question, does it help ?

OTHER TIPS

Lua is famous for being ridiculously easy to embed in C/C++. Its VM is open source and cross-platform, very small (both exe size and bytecode instruction set) and at the same time quite fast. But its bytecode may be not suitable for your language. The bytecode format is documented here.

NekoVM is a programming language and a lightweight virtual machine designed as a generic target for compiler writers. The documentation makes it seem really easy to embed the VM in a C or C++ application, but it seems the VM API is not yet documented.

Other possible answer : why not output assembler instead ? it's fast and lightweight, and you don't need a VM at all. Since you target x86 only, it could make sense, depending on what you're trying to do.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top