The JVM instruction set provides a straightfoward method to translate Fortran GOTO statements. Since Fortran 77 does not specify while loops, these are implemented in BLAS and LAPACK using goto statements, which are supported at the JVM level.

Since ANSI Fortran 77 does not specify while loops, all such constructions in the BLAS and LAPACK are implemented with goto statements. Since the JVM has built-in goto branching, f2j easily implements all goto statements in the Fortran source by directly generating bytecode. However, we also have a scheme to translate Fortran GOTO statements into Java source code, which involves some post-processing of the generated code.

Complex numbers will most likely have to go directly to bytecode for implementation on the JVM stack. Using the object-oriented methods for complex arithmetic would likely produce unacceptable overhead for large scale numerical problems.

LAPACK

Java LAPACK has now completed the testing stage. Some of the main design issues are:

Arrays are being implemented as 1 dimensional in the Java translation. Access is by index arithmetic, using leading dimensions declared in the Fortran source. This allows emulation of passing array subsections.

Certain variables are returned by reference, which has no counterpart in Java. Currently all scalar variables which are determined to be used in a pass-by-reference context will be wrapped as an object with a single (value) field.

We are now directly generating JVM class files, so GOTO statements are not a problem anymore, but for generating and recompiling Java source code, the translation of GOTO statements is done with a post-translation processing step. First, we use f2java to translate the Fortran code to Java. GOTOs are automatically translated as calls to a dummy class. So, GO TO 100 would be translated as Dummy.go_to(100); . The labels in the Fortran source are also translated as calls to the dummy class (for example, the label 100 becomes Dummy.label(100); in the Java source). Next we compile the Java file as usual (using javac). We then use a special program to analyze the bytecode and translate the dummy goto calls to real JVM goto instructions. Our tool is based on the bytecode parser in javab, a bytecode parallelizing tool under development at the University of Indiana.

A general solution for translating Fortran to Java may not be available without using object methods, possibly incurring large performance penalties. Our alternative is to chose those features most important to efficiency in numerical analysis, and direct the translation using the known structure of the BLAS and LAPACK Fortran source

The BLAS, Basic Linear Algebra Subroutines

Java BLAS is translated from the BLAS Fortran reference source archived at the Netlib numerical software
repository. BLAS is composed of three levels of linear algebra operations: