Tuesday, August 26, 2008

Register VMs : Rise of the machines

I am currently designing and implementing small language with in-built concurrency for experimental/learning purpose. I decided to go with virtual machine approach, but when we implement a virtual machine, we hit by a long-running question in the design of virtual machines, whether to go with stack architecture or with register architecture?

Many of virtual machines are implemented with stack architecture.

Stack based VMs:
  • The Java Virtual Machine.
  • .NET CLR
  • Perl 5 virtual machine.
  • SQLite Virtual Database Engine.

There is lot of interest in implementing VM based on register architecture too and practical register based VMs are started emerging.

Register based VMs:
  • Parrot VM - http://en.wikipedia.org/wiki/Parrot_virtual_machine
  • Android Dalvik VM - http://en.wikipedia.org/wiki/Dalvik_virtual_machine
  • Webkit Javascript VM - http://webkit.org/blog/189/announcing-squirrelfish/

I decided to go with register based VM, thought of below two options and decided to go with first.

1) Implementing my register based VM in C

2) Implementing my register based VM in Java (Hey, java is improving and sun is adding multi language support and it is open!!!, so why not?) - In this case my VM itself interpreted on stack based JVM!!!