Presentation is loading. Please wait.

Presentation is loading. Please wait.

Toba Gregg M. Townsend Executable Code from Java Source.

Similar presentations


Presentation on theme: "Toba Gregg M. Townsend Executable Code from Java Source."— Presentation transcript:

1 Toba Gregg M. Townsend gmt@cs.arizona.edu Executable Code from Java Source

2 2 Original Java Model Interpretation Just-in-time (JIT) compilation Java source class files execution

3 3 Toba: WAT Compilation Quick startup Fast execution Java source class files machine code execution

4 4 Applicability of Toba Not for applets –not architecture-independent –machine code can’t be trusted For stand-alone applications –Java compiler –“server side” programs –many other possibilities

5 5 Full Language Support Array bounds checking Thread support Garbage collection Finalization

6 6 Some Competitors Cut Corners No bounds checking? –run 7% faster No threads? –run 8% faster No garbage collection? –small programs run fine

7 7 Toba’s Limitations No dynamic loading –work in progress No graphics library –will come No debugging aids –no stack tracing

8 8 Built from Free Software Sun JDK 1.0.2 –Java compiler (javac) –Java library (“API”) Boehm-Demers-Weiser conservative garbage collector Solaris thread library Toba code

9 9 Toba Components Class file translator –written in Java –4000 lines of code Runtime support –written in C –3000 lines for language support –3000 lines for API helpers

10 10 Building Programs with Toba Java source code javac class files toba C code C compiler object code ld executable file

11 11 File Sizes 110 KB.java source code (4000 lines) 78 KB.class files 633 KB.c and.h files (24000 lines) 325 KB.o object code files 294 KB a.out executable file –using shared libraries For the Toba translator, on a Sun:

12 12 The Translator’s Job Reads class files Writes ANSI C code –initialized data structures class information –executable code C function for each method plus wrapper if synchronized

13 13 Naive But Effective Classes, methods, and instructions are mostly treated in isolation Java stack references become C variable references The generated code is simpleminded C compilers handle it well and produce efficient code

14 14 Performance Measurements Execution times of real programs from the Internet

15 15 Sample Code i1 = iv2; i2 = iv3; i1 = i1 + i2; iv1 = i1; iload_2 iload_3 iadd istore_1 a = b + c; JavaJVMC


Download ppt "Toba Gregg M. Townsend Executable Code from Java Source."

Similar presentations


Ads by Google