Report ID
1998-18
Report Authors
Holger Kienle and Urs Hï½lzle
Report Date
Abstract
To compete with optimized C, object-oriented languages need classicaloptimizations as well as specific object-oriented optimizations. Therefore, acompiler infrastructure that enables object-oriented compiler research is ofgreat interest for the research community. The SUIF compiler system with theOSUIF extension offers such a research environment. SUIF defines anintermediate representation for procedural languages and offers standardoptimization passes. OSUIF extends SUIF with an intermediate representationtailored towards object-oriented languages, hence allowing specificobject-oriented optimizations.To enable Java-related compiler research in (O)SUIF, we have implemented j2s, aJava bytecode front end for the OSUIF/SUIF 2.0 compiler system. Our compileruses off-line compilation, so that the whole program is known at compile time.Thus, static whole-program optimizations such as class hierarchy analysis andtype inference can be implemented with (O)SUIF and applied during thecompilation.j2s supports the complete Java Virtual Machine specification, except forthreads and exception handling, which are currently not supported by theruntime system and (O)SUIF. Because we implemented an off-line compiler, thedynamic loading of classes is also not supported.The compiler is divided into the (O)SUIF front end and the runtime system. Themain part of the thesis describes the compilation passes, which consist of Javaclass loading, resolution of symbolic references in class files, control flowgraph generation, data flow analysis to recover lost type information in classs, and finally the actual (O)SUIF code generation. The compiler generateseither plain SUIF 2.0 or OSUIF code.Java, in contrast to C, requires a sophisticated runtime system. This thesiscontains a detailed description of the interface between j2s and the runtimesystem; the runtime system itself has been written by Andrew Rutz as part ofhis Master\'s thesis.The current version of j2s compiles Java applications that require neitherthreads nor exception handling during program execution. Despite theserestrictions a large number of Java applications compiles and executes. Forexample, our compiler can handle the transitive closure of the JDK1.2beta2javac compiler, which consists of 538 Java classes. The javac executablegenerated with our compiler runs about twice as fast as the JDK1.2beta2 VirtualMachine.
Document
1998-18.ps1.99 MB