06 junio 2012

The history of Zero

It is curious how fast time goes by. I started Zero in 2003, with the assembler and bytecode specifications, and the next year, around this dates, Zero will turn 10.

The development of Zero is not competely stopped. I still have the PROWL compiler very present, obtaining a lot more stability and portability, specially with Windows 7 (it seems that with Win7 it does not feel comfortable, in contrast to the Linux version, maybe the first example of a non-deterministic program). It is nevertheless true that the system is quite complete since a few years ago, and it has been used for the practices part of an undergraduate subject, as a multilanguage, programmable systems offering dynamicity and persistence. Students have also volunteered with exercises written in PROWL, such as polish calculator, interactive fiction, etc.

The question I have been more frequently asked during these years is about the VM's registers... why so few? The answer is that, when I designed it, I was trying to make it as minimalist as possible, and that within the reasonable, to be as simple as possible so its characteristics and registers could easily be mapped to the x86 family, with a possible JITter in mind. So, it presents the __ip, i.e., the program counter, hidden but modified by JMP, JOT and JOF; __exc holding a reference to the object describing the exception thrown. It could be used as a generic, extra register, but this would be more hacking that anything else. The accumulator, or __acc, working as in x86, since the result of any assembler opcode goes there (I was however, more romatically inspired by the Z80; this chip derives from the 8080, and that is the father of the x86 family ).

There are four general purpuse registers, abbreviated as gp: __gp1, __gp2, __gp3 and __gp4. Finally, the __rr register holds a references to the result returned by a given method. This register is of course manipulable during the method execution, provided that the it holds the final result at the end of the method (it is directly set by RET, which must be the last instruction in the method).

The programmer can also count with __this, which references the object executing the method (not the method containing the method, that's another, rather different concept). It won't be a good idea to manipulate that, unless you exactly now what you're doing.

The meaning of general purpose for registers has something anecdotical: the now famous jeep of the USA army during WWII have their name deriving from exactly "general purpose" -> "gp" -> "jeep". Actually, the name of this cars does not mean anything specific. The name of the Zero's registers then is general purpose 1, general purpose 2... and for me, just jeep1, jeep2...