Harissa is a Java environment that includes a compiler from Java bytecode to C and a Java interpreter. While Harissa is aimed at applications that are statically configured, such as the Javac compiler, it is also designed to allow code to be dynamically loaded in an already compiled application. This novel feature is introduced by integrating our bytecode interpreter in the runtime library. Data structures are compatible between the Java compiled code and the interpreter, and data allocated by the interpreter does not conflict with data allocated by the compiled code. Harissa is written in C and provides an efficient and flexible solution for the execution of Java applications.
Harissa's compiler, called Hac, generates C code that can be compiled into efficient native code. To do so, several transformations have been implemented. First, the stack is statically evaluated away. Second, virtual method calls are transformed, when possible, into static (i.e., procedure) calls using a Class Hierarchy Analysis (CHA). For these virtual calls, type checks are also eliminated. Finally, Hac implements several other more conventional optimizations for object-oriented languages such as method inlining.
Harissa was previously called Salsa (the
dance). Unfortunately, the name "salsa" was a registered trademark
from Wall Data Incorporated. Thus, we had to find a new name. Harissa
simply means Salsa Picante .
Harissa runs under Solaris 5.5, Sun/OS 4.1.4, Linux 2.0. It supports
the Java Developper Kit 1.0.2.
Harissa
allows the mixing of compiled binary code and interpreted Java
bytecode. Test programs demonstrating Harissa features can be found in the
Harissa demo suite.
Whole-program optimizations such as the CHA require the compilation of
all classes referenced by a Java program. Therefore, many classes of
the Sun Java library are translated for each use of the Harissa
compiler, since the code generated differs from one program to
another. Drawbacks are that it consumes disk space and the compilation
process is a little bit slow for large programs such as the
javac compiler (10mn on a PC/Pentium 90Mhz).
Support for
separate compilation has been introduced sinced the
alpha2.1 version. Librairies of classes can be
compiled independently and be included in further compilations. CHA
can be still used on classes that are not in libraries. This scheme
avoids drawback of the complete CHA but trades space and compilation
time for performance.
An optimized
runtime system can be generated when the compiler detects that threads are
not used by the application. This optimization can for instance be used
for compiling the javac compiler. It only works when
dynamic loading is not used.
C
generated code compiles either with gcc (version 2.7.2 tested
successfully) or Sun CC. On Sparc machines, CC is faster most of the time.
The
alpha3.02 implementation comes with thread support
based on posix threads for both Solaris and Linux.
The
alpha3.02 implementation comes with graphic support
based on the biss library.
Harissa is provided with and without Garbage Collection. The GC
version is based on the Boehm-Demers-Weiser
conservative garbage collector. At the current time, the GC
version does not work with pthreads.
Harissa can
also be used as a front-end for our C-specializer Tempo. By
specializing the C code, we have been able to obtain speed-up of up to
six on several graphics applications. We are looking
for graphic and computation examples. If your application is too slow
and you think there are good opportunities for specialisation inside
(i.e., generic algorithms), please contact us.
Some minor
functions of the Java virtual machine are still missing. However, the
implementation is sufficiently mature to support complex programs such
as the javac compiler or the javadoc documentation generator.
Harissa is covered by a copyright statement that allows non-commercial use without fee. The Boehm-Demers-Weiser conservative garbage collector is covered by its own copyright.
Harissa is distributed in binary form:
Linux 2.0 alpha3.02 version gzipped tar file (GC and non GC versions)Notes:
Solaris 5.5-gcc alpha3.02 version gzipped tar file (GC and non GC version)
Solaris 5.5-CC alpha3.02 version gzipped tar file (GC and non GC version)
SunOs 4.1.4 alpha2.2 version gzipped tar file (GC and non GC versions)
Linux 2.0 alpha2.2 version gzipped tar file (GC and non GC versions)
Solaris 5.5 alpha2.2 version gzipped tar file (GC version only)
You will also need Sun java classes (classes.zip) from version 1.0.2 of the Java Developers Kit. Get the Solaris version from java.sun.com or the Linux version from www.blackdown.org.