This year (2010) during Google Summer of Code a project for creating a Just-In-Time compiler for the Tcl language started its coding phase. It is still on a very initial phase, but it may be at least interesting to some people to get to know more about it without deciphering its code. The text below (after editing this for some more time) reflects the current state of the compiler.

See Also

GSOC2010:Base JIT compiler for Tcl



Stack machine to Register machine


Register allocation

Instruction selection

Code generation


Advanced Compiler Design Implementation - Steven S. Muchnick. This book starts right away indirectly mentioning the importance of different levels of intermediate representation (it always addresses a lot of optimizations). Converting the stack machine nature of the Tcl VM to quadruples was motivated by some of the reasons present on this book. The CACAO JVM (not sure if it still an active project) also performs this conversion, it might be interesting to read the paper CACAO - A 64 bit JavaVM Just-in-Time Compiler by Andreas Krall and Reinhard Grafl.

Larry Smith Seems to be:

Some other references:

Register allocation is not done at all at this point, but, for now, the ones that are on the queue to be eventually implemented here are described in these papers: A Fast, Memory-Efficient Register Allocation Framework for Embedded Systems, Linear Scan Register Allocation for the Java HotSpotTM Client Compiler (Master thesis, describes this process very well), Linear Scan Register Allocation on SSA Form, Linear Scan Register Allocation. These represent basically two forms of register allocation: by density usage and linear scan (I believe this second is more known).

Code generation for IA-32 was totally based on the Volumes 2A and 2B by Intel (Intel® 64 and IA-32 Architectures Software Developer’s Manual) and also some disassembling (check the otx tool for Mac OS X, objdump under Linux was good too).

Interesting References not necessarily used at this point

Optimizing Compilers for Modern Architectures - Randy Allen and Ken Kennedy. Explores mostly data dependence optimizations, queued to be added for this compiler at some point.

Code Link