Thursday, March 19, 2009

So I called up Gerry Sussman and told him I needed a job. I was hoping, of course, that he would suggest some part-time work at the AI lab. Instead, he suggested that I get in touch with Rick Greenblatt over at Lisp Machine, Inc. A few days later Rick invited me to come up and see him at LMI. He told me that Gerry thought I could be useful and started me off with the microcode tracer.

There's nothing like diving right into something you know absolutely nothing about.

The Lisp machine microcode is a fairly insane chunk of software. There was no real documentation for it. The functionality is pretty straightforward if you are familiar with the processor architecture, and only a handful of hackers had ever written any substantial amount. If you wanted to hack the microcode, you just had to ask Moon or RG to show you and tell you about the coding conventions.

The microcode became a pile of spaghetti over the years, and it was getting harder and harder to figure out what was going on. The microcode had no scoping constructs. Every variable, temporary, bit field, chunk of state, or whatever had to live in a register. That was ok because there were thousands of registers. This is sort of like having thousands of global variables. Some of them even had names, and some of the named ones even had useful names. On occasion, there'd be some documentation that would tell you things like

The microcode tracer was an attempt to impose a bit of order on this chaos. The idea was to add declarations to the microcode at the entry to basic blocks and have a program verify that the declarations are correct. An error would be raised if some path through the code clobbered a register that was not explicitly listed. Rick had written a bit of code for the microcode tracer, so he wanted me to expand on it. Rick's code is here http://code.google.com/p/jrm-code-project/source/browse/trunk/lambda/rg/old-micro-trace.lisp

To tell the truth, I'm not sure how well I understood what I was doing. I was sure that I didn't understand what Rick's code was trying to do, so after puzzling over it for a few days, I started writing my own version. I soon discovered problems...