What is the JBuilder Just-in-Time Compiler?

By: David Intersimone

Abstract: A Just-in-Time compiler (JIT) works like a cache. When a Java method is executed often enough, the JIT compiles the machine independent Java byte code that is loaded from the class file into x86 machine code.

What is the JBuilder Just-in-Time Compiler?

by David Intersimone and Christian Kemper
Inprise Corporation

A Just-in-Time compiler (JIT) works like a cache. When a Java method is executed often enough, the JIT compiles the machine independent Java byte code that is loaded from the class file into x86 machine code.

The JIT works on a method-by-method basis whenever a method is called. You don't have a penalty when the class is loaded, because the JIT doesn't compile at load time. The JIT won't compile a method until your program invokes that method. If, for example, you use only 20 percent of the methods in a class, the JIT will only compile these 20 percent.

The JIT simulates the execution of a method. For example, in order to add A and B and write the result into the variable C, the typical byte code sequence would be, "push A, push B, add, pop C" because the Java Virtual Machine is a stack machine. However, you don't want to load these two variables into temporaries, to simulate the operand stack of the virtual machine. You would have to add them, write the result back into a temporary, and store that temporary into the variable C. That's not very efficient. Instead the Borland JIT uses register allocation and delays code emission until it can make use of the addressing modes of the processor as well as possible. For this example, if these three variables were allocated in registers, the corresponding code would be "move A to C, add B to C".

Porting the JBuilder JIT from Windows to Linux

The biggest chunk of work (in porting the JBuilder JIT from Windows to Linux) was in moving the exception handling code. The Windows exception model is radically different from the one used on Linux. Unfortunately the JIT is not using explicit null pointer checks and is relying on getting a hardware exception (or a signal in Linux/Unix terms) instead, so porting this was absolutely mandatory. And because the JIT does not compile every method, compiled code has to be able to catch exceptions thrown by interpreted methods and vice versa.

Getting the JIT to compile on Linux was a challenge in itself. The JIT has to be able to jump back and forth between compiled code and interpreted code. So there is a lot of inline assembly code that deals with setting up the registers, retrieving results and so forth. These routines were obviously written using Windows/Intel inline assembly and so they had to be ported over to the GNU/AT&T syntax.

JBuilder Java 2 JIT for Linux Q&A

1. What is a Just-in-Time Compiler (JIT)?
A Just-in-Time Compiler dynamically compiles Java byte-code into native machine code to speed up the execution of Java applications.

2. Why do I need the JBuilder JIT for Linux?
The JBuilder JIT for Linux provides significant performance improvements for Java 2 applications on the Linux platform. In testing real world applications, including JBuilder and the Java compiler (javac), running with the JBuilder JIT for Linux improves performance 33% over the default Java 2 JIT for Linux contained in the Blackdown port of the JDK.

3. What JDK does the JBuilder JIT for Linux support?
The JBuilder JIT for Linux works with the Blackdown Java 2 JDK (www.blackdown.org) and with the Sun/Inprise/Blackdown JDK 1.2.2 (java.sun.com).

4. Where can I get the Linux Java 2 JDKs?
You'll find the latest release candidates of the Java 2 JDK for Linux at:
    Sun/Inprise/Blackdown Java 2 JDK
    Blackdown Java 2 JDK

5. Can I distribute the JBuilder JIT for Linux?
No, the Preview Release of the JBuilder JIT may not be redistributed. The final release will be redistributable.

6. When will the final version of JBuilder JIT for Linux be released?
The final release of the JBuilder JIT for Linux is part of the Sun/Inprise/Blackdown Java 2 JDK (java.sun.com).

7. How much will you charge for the JBuilder JIT for Linux? Will it be free?
The JBuilder JIT for Linux will continue as a free download to benefit the Java 2 community on Linux.

8. What are the system requirements for the JBuilder JIT for Linux?

    Linux: The JBuilder JIT for Linux has been certified with the RedHat 6.0 and RedHat 6.1 versions of Linux. It should also work with other Linux distributions that are using glibc2.1 or greater.
    Processor: The JBuilder JIT for Linux only supports x86/Linux versions.

9. How do I install the JBuilder JIT for Linux?
To use the JBuilder JIT for Linux you can either set the environment variable JAVA_COMPILER to javacomp (e.g export JAVA_COMPILER=javacomp if you are running bash) or you can set the JDK system property when you invoke the Java runtime:

    java -Djava.compiler=javacomp HelloWorld
    to run HelloWorld using the JBuilder JIT for Linux
    or
    javac -J-Djava.compiler=javacomp HelloWorld.java
    to use the JBuilder JIT for Linux with javac

10. How much faster is the JBuilder JIT for Linux?
Applications run approximately 33% faster using the JBuilder JIT for Linux when compared with the default Java 2 JIT for Linux. Internal tests include compiling large Java applications using javac, which ran 33% faster.

11. Is the source code available for the JBuilder JIT for Linux?
No.

12. Will there be a version of JBuilder for Linux?
Yes  JBuilder 3 Foundation for Linux is available at http://www.borland.com/jbuilder

13. What other platforms does JBuilder support?
JBuilder currently runs on the various Windows platforms (Win 95/98/NT4), and on Solaris. JBuilder Foundation is available on Linux, Solaris and Windows NT.

Download JBuilder JIT for Linux Preview Release Now!

Server Response from: SC1