Salsa Manual


Installing Salsa

To install salsa:


How to use Salsa

Salsa offers two commands:

Salsa

salsa is a Java interpreter. Its syntax can be obtained by executing it with no parameters:

Salsa version alpha2.0 copyright (C) Irisa/Inria 1996
syntax: salsa [-p] class args...
-p : generate profiling information
'class' is a class containing a 'main' method which will be launched.
        Its signature must be  'public static void main(String[])'.
'args' are the arguments given to the 'main' method.

The profiling information is written into the files vm.prof and call.prof.

Salsa2c

salsa2c is a Java to C translator. A C source file is generated for each Java class used by the compiled application. The syntax can be obtained by executing salsa2c with no parameters:

 salsa2c version alpha2.0 copyright (C) Irisa/Inria 1996
syntax: salsa2c [-C] [-o object] [-i size] [-B] [-T] [-P] [-g] [-R] [-J]
                [-h] [-d path] command classes...
'command' : one of header,stub,src,code,prog
'classes' : the Java classes to handle
-h : print this help
-B : no bound checks
-T : no type checks
-i size : allow method inlining when bytecode size <= size
-s : assume that no class will be loaded dynamically
-P : print bytecode within each method
-C : Class Hierarchy Analysis
-J : Generate a jump to a common label for index bound exceptions (default for i386)
-R : Generate a dummy return after index bound exceptions (default for the SPARC)
-g : include source file information (name of variables, name of fields)
-d dir : directory of generated C sources (default='./gen')
-o object : name of executable binary (default='a.out')

When you compile a Java program into C, the C source files are written by default within the directory ./gen. A Makefile is also created. To compile the C sources you only need to go in the gen directory and type make.

Behavior of commands:

Behavior of options:

At the current time, salsa relies on some GCC (version 2.7.2) C extensions. However, the code can be post-processed using the Suif optimizer in order to remove transient variables and beautify the code.


Compiling the Javac compiler

Create a gen directory. Then, type the command:

  salsa2c -C -i100 -s -o salsac prog sun.tools.javac.Main
  cd gen; make

On a PC/Pentium 90 Mhz, C code generation takes about 2 mn. C code compilation by Gcc 2.7.2 with the "-O2" option takes about 8 minutes.


Choosing between the GC and the non-GC version

Salsa is provided in two different configurations with and without Garbage Collection. The GC version is based on the Boehm-Demers-Weiser conservative garbage collector. The non GC version is based on the system malloc primitive. Since objects are never deallocated, it leads to an increase of the heap segment and a slow down of the application due to disk swapping.

The choice between the two versions is done by linking the application either with lib/mmwithgc/libmem.so or lib/mmwithout/libmem.so. To switch between versions, you have to change the LD_LIBRARY_PATH and SALSA_LIB_MEM variables. Also, since the libmem.so library is statically linked with the program, the link phase has to be redone. To to so, the application binary must be removed and the make restarted.


back to the salsa home page