5. Status
As of early July 1997, jc1 was able to
compile a simple test program, which calculates the Fibonacci numbers
(up to 36), both iteratively and recursively (which is slow!), and
prints the results. No manual tinkering was needed with the assembly
code generated, which was assembled and linked in with kaffe (a modified pre-0.9.1 snapshot) as the
run-time engine. On a SparcStation 5 running Solaris2, it took 16
seconds to execute. In comparison, the same program dynamically
compiled by Kaffe's JIT takes 26 seconds, and Sun's JDK 1.1
takes 88 seconds to run the same program.
These numbers are encouraging, but they need some context. Start-up
times (for class loading and just-in-time compilation) should in all
cases be fairly minor, since the execution time is dominated by
recursive calls. In the jc1-compiled case,
only the actually test class (calculating Fibonacci plus the main
methods that prints the result) is compiled by jc1; all the other
classes loaded (including the classes for I/O) are compiled by kaffe's JIT-compiler. This means there would
be some slight extra speed up if all the classes were jc1-compiled. Do note that the test-program uses
simple C-like features that are easy to compile: integer arithmetic,
simple control structures, and direct recursion. The results cannot be
directly generalized to larger programs that use object-oriented
features more heavily.
The basic structure of the compiler works, but there is still quite
a bit of work to do. Many of the byte-codes are not supported yet, and
neither is exception handling. Only some very simple Java-specific
optimizations are implemented. (Of course, jc1 benefits from the existing
language-independent optimizations in gcc.)
The Kaffe VM works on most Java code. We have enhanced it in
various ways, and modified the data structures to be simpler and more
suitable for being emitted by the compiler.
The Java support in the gdb debugger is
partially written, but there is still quite a bit to go before it is
user-friendly. We have not started work on our own library
implementation or source-code compiler.
|