VM2
From Mindstab Wiki
VM2 never happened, got forgotten and then a year or two later I wrote fast-lang. Which really wasn't a more fully feature vm-proto, it was actually a simpler, but faster version. Here's the original page:
VM2 is my second attempt at writing a small virtual machine. The first attempt was VM-proto. These attempts are mostly proof of concept/knownledge. Just a way of applying what I've learned and learnign some more.
The generalized goal of VM2 is to be better than VM-proto. By better I mean faster and more featured.
Faster
My speed test uses primes:
Prime number benchmarks Benchmark machine: Linux inferno 2.6.10-5-386 #1 Tue Apr 5 12:12:40 UTC 2005 i686 GNU/Linux (1/36) C results: Compile [gcc]: 0.31 seconds Execute: 0.05 seconds (13/36) C# (Mono) results: Compile [mcs]: 0.79 seconds Execute [mono]: 0.48 seconds (17/36) PERL results: Execute [perl]: 1.11 seconds (19/36) Python results: Execute [python]: 2.88 seconds ... haplo@inferno:~/src/my/vm-proto $ time ./vm primes.vmo > /dev/null real 0m1.158s
As you can see VM-proto was on par with interpreted languages like perl even though it is compiled to byte code. I believe I can do much better than that with VM2
Features
I ran into design problems pretty quickly with VM-proto. Here is a short list of features I'd like VM2 to have:
- Variables: non register data storage :)
- Proper dynamic naming tables so that we can have...
- Mutli object programs (so we can actually have object libraries)
If I can accomplish all that I'll be pretty pleased. More experimental features I might try to add but will probably be deferred to VM3 or later would be
- Context switching and multi-threadedness
