[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1. Introduction and rationale for libjit

Just-In-Time compilers are becoming increasingly popular for executing dynamic languages like Perl and Python and for semi-dynamic languages like Java and C#. Studies have shown that JIT techniques can get close to, and sometimes exceed, the performance of statically-compiled native code.

However, there is a problem with current JIT approaches. In almost every case, the JIT is specific to the object model, runtime support library, garbage collector, or bytecode peculiarities of a particular system. This inevitably leads to duplication of effort, where all of the good JIT work that has gone into one virtual machine cannot be reused in another.

JIT's are not only useful for implementing languages. They can also be used in other programming fields. Graphical applications can achieve greater performance if they can compile a special-purpose rendering routine on the fly, customized to the rendering task at hand, rather than using static routines. Needless to say, such applications have no need for object models, garbage collectors, or huge runtime class libraries.

Most of the work on a JIT is concerned with arithmetic, numeric type conversion, memory loads/stores, looping, performing data flow analysis, assigning registers, and generating the executable machine code. Only a very small proportion of the work is concerned with language specifics.

The goal of the libjit project is to provide an extensive set of routines that takes care of the bulk of the JIT process, without tying the programmer down with language specifics. Where we provide support for common object models, we do so strictly in add-on libraries, not as part of the core code.

Unlike other systems such as the JVM, .NET, and Parrot, libjit is not a virtual machine in its own right. It is the foundation upon which a number of different virtual machines, dynamic scripting languages, or customized rendering routines can be built.

The LLVM project (http://www.llvm.org/) has some similar characteristics to libjit in that its intermediate format is generic across front-end languages. It is written in C++ and provides a large set of compiler development and optimization components; much larger than libjit itself provides. According to its author, Chris Lattner, a subset of its capabilities can be used to build JIT's.

Libjit should free developers to think about the design of their front ends, and not get bogged down in the details of code execution. Meanwhile, experts in the design and implementation of JIT's can concentrate on solving code execution problems, instead of front end support issues.

This document describes how to use the library in application programs. We start with a list of features and some simple tutorials. Finally, we provide a complete reference guide for all of the API functions in libjit, broken down by function category.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.1 Obtaining libjit

The latest version of libjit can be obtained from Southern Storm Software, Pty Ltd's Web site:

http://www.southern-storm.com.au/libjit.html


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.2 Further reading

While it isn't strictly necessary to know about compiler internals to use libjit, you can make more effective use of the library if you do. We recommend the "Dragon Book" as an excellent resource on compiler internals, particularly the sections on code generation and optimization:

Alfred V. Aho, Ravi Sethi, and Jeffrey D. Ullman, "Compilers: Principles, Techniques, and Tools", Addison-Wesley, 1986.

IBM, Intel, and others have done a lot of research into JIT implementation techniques over the years. If you are interested in working on the internals of libjit, then you may want to make yourself familiar with the relevant literature (this is by no means a complete list):

IBM's Jikes RVM (Research Virtual Machine),
http://www-124.ibm.com/developerworks/oss/jikesrvm/.

Intel's ORP (Open Runtime Platform),
http://orp.sourceforge.net/.


[ << ] [ >> ]           [Top] [Contents] [Index] [ ? ]

This document was generated by Klaus Treichel on May, 11 2008 using texi2html 1.78.