Just-In-Time Compiler Library

Copyright © 2004 Southern Storm Software, Pty Ltd


[ << ] [ < ] [ 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.


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

This document was generated on April 29, 2015 using texi2html 5.0.