Götterdämmerung

Ben Goetter's unnecessarily apocalyptic weblog.


Sat, 25 Nov 2006

Direct-threaded Interpreter

I've completed a first cut at a proof of concept for a direct-threaded interpreter, implementing a amazing language capable of generating any list of the digits 1, 2, and 3. (Just look out, world. Next week: the digit 4!) One version of the interpreter runs on x86, where I could use inline assembly in my C compiler to manipulate the callstack while leaving the majority of the implementation in C: call this version the proof of concept of a proof of concept. The other version runs on my target processor, the ARM, where my compiler doesn't support any sort of inline assembly; there, the entire interpreter core is in assembly, calling back into the C-language pscheme kernel for consing and so forth. This offers a strong motivation to keep the VM small.

In the VM I described a couple of weeks ago, the FRAME and CONT registers can be unified, CONT being just a couple more fields in the frame. I was led astray by not originally realizing that even the topmost computation has a continuation, and that my VM should make that outermost continuation explicit. Oddly, I realized this immediately upon waking one morning.

posted at: 19:34 | path: /pscheme | permanent link to this entry


Powered by blosxom.
Based on a true story.
Syndicate this, if you dare.
Copyright 2006, Ben Goetter. All rights reserved.