Toba: A Java-to-C translator
Toba translates Java
class files into C source code.
This allows the construction of directly executable programs
that avoid the overhead of interpretation.
Toba deals with stand-alone applications, not applets.
Toba actually reads Java class files, the object code files
produced by the Java compiler for an abstract "Java virtual machine" (JVM).
The generated code is designed not for human readability
(although that's not impossible)
but rather for easy optimization by a reasonably clever C compiler.
Translation of a class file yields a .c file and a .h file.
Each .c file references its own .h file and also the .h files
of other classes referenced by the class file.
Toba 1.1 supports the JDK 1.1 API, and runs under Solaris 2.5 on SPARC and
Linux 2.0 on Intel x86. All platforms have thread and AWT support,
and a JIT compiler is available under Linux/Intel.
Usage
A Java program can be translated to produce an executable a.out file
through the simple Unix command toba filename.java
.
More complex operations also follow the the model of cc.
[More details.]
Compatibility
Toba supports true dynamic loading on platforms that have a JIT compiler
(currently only Linux/Intel). On other platforms, Toba does
not support true dynamic loading but does load precompiled
classes dynamically.
Most Java applications not needing dynamic loading and AWT support
function identically when built by Toba. Some differences may
be apparent when using the AWT which is based on the
BISS AWT package.
Additional differences are minor.
[More details.]
Native Code Interface
Functions written in C can be linked with Java files translated by Toba.
The interface, however, differs from the Sun native code interface.
[More details.]
Performance
Performance gains range from noticeable to spectacular, depending on the
application.
Computationally-intense applications see the largest gains.
The Toba executable runs about four times as fast as the interpreted
version.
Implementation
Toba consists of a classfile translator written in Java and some
interface code written in C. Supporting code includes:
[More details.]
Porting hints are available.
Release notes track the evolution of Toba.
Heritage
Toba was produced by the Sumatra group:
Todd Proebsting, John Hartman, Gregg Townsend, Peter Bigot,
Patrick Bridges, Tim Newsham, and Scott Watterson.
Please send us your comments.
We're part of
the Liquid Software project
of the Department of Computer Science
at the University of Arizona.
index
| usage
| differences
| native code
| implementation
| porting
| releases
| installation
|| home
http://www.cs.arizona.edu/sumatra/toba/doc/index.html (July, 1998)