Cliff Hacks Things.

Wednesday, February 22, 2006

IT'S ALIIIIIVE!

Since Saturday, I've been hacking on M2VM, my next-generation Mongoose VM. It uses the VM-generation utility I described in my last post.

As of tonight, it works. I have:

1. Designed a class-file format, similar to Java's but better suited. (This is a stopgap measure; M2VM will load classes a module-at-a-time using a yet-to-be-defined format based on the class-file format.)
2. Written a set of utilities (in Java) for building up M2VM code, in preparation for a compiler. (At this point, it generates class files from a tree-based IR, so the compiler layer will be very thin and probably entirely ANTLR.)
3. Written the VM generator (in Ruby) that transforms 151 lines of very manageable domain-specific code into 334 lines of VM inner loop.
4. Written a rudimentary memory manager and garbage collector (in C) with the fundamentals of my eventual zone-based scheme.
5. Written a stopgap class loader (in C) that works with the object memory API to build classes in RAM.
6. Written a test framework that creates objects and sends messages to them.

So, having fed it the equivalent (in pseudocode) of:

sample() {
return self.
}


...I now get a correct return value!

Nested and recursive calls also work.

I'm using my generator in switched mode, so I need to kick it into direct-threading and test that. (It works for some limited test input, and most of the code is boilerplate in the Ruby.) I also need to test some fundamentals — argument passing comes to mind — and flesh out some error handling, but...

... it works!

0 Comments:

Post a Comment

<< Home