javat - The Java Translator from Bytecode to MIPS Code

javat translates Java bytecodes to native MIPS instructions.

SYNOPSIS

javat [-d] [-u] inputfile.class ...
javat -o outputfile.class [-u] inputfile.class

DESCRIPTION

A Java .class file as produced by the Java compiler (javac) normally contains instructions called bytecodes that are executed by a software interpreter in the java command. The javat command can be used to translate these bytecodes to native MIPS instructions and add these MIPS instructions to the .class file. When a .class file that has been translated in this way is executed by the java command with the -tran option, these native MIPS instructions will be used instead of the bytecodes. The native MIPS instructions will be executed directly by hardware at a much higher level of performance than interpreting bytecodes.

The instructions added to the .class file by javat are the same as those that would be generated if java were run with the -jit (just-in-time compiler) option. By creating these instructions beforehand using javat, complex applications can be started up more quickly. The -tran and -jit options can be combined when giving the java command, in which case MIPS instructions will be loaded from the .class file if they are there (-tran) and created dynamically if they are not (-jit).

The input to javat is one or more Java .class files whose pathname is given on the command line. The resulting .class file with the added native instructions is placed in the current directory unless the -o option is given. Thus the command

javat some_directory/foo.class
will put the resulting foo.class file in the current directory rather than in some_directory. If the input file is in the current directory, javat will correctly overwrite it with the new file. (The input file will not be overwritten until the output file has been fully created to replace it.) Thus the command
javat *.class

will add native MIPS instructions to all the .class files in the current directory. The following commands in csh or tcsh will translate all .class files in the directory hierarchy rooted at the current directory:

> foreach i (`find . -name "*.class" -print`)
foreach? javat -o $i $i
foreach? end
> 

If a .class file already contains MIPS instructions, they are replaced by the newly generated code.

OPTIONS

-o path
Specify that the output .class file be given the name path. The file will be overwritten. If it is the same as the input file, the input file will not be overwritten until the output file has been successfully created. This option is invalid if more than one input .class file is specified.

-d
Specifies that a dump of the contents of the .class file be created, including a listing of the MIPS instructions that would be created for the file. The dump is written to the standard output. No new .class file will be created.

-u
This will cause a new .class file to be written in the normal manner, except that there will be no MIPS instructions in the resulting .class file. If the input .class file had MIPS instructions in it, they will be removed.

SEE ALSO

javac, java, appletviewer