A Retargetable Optimizing Java-to-C Compiler for Embedded Systems
Master's Report,
Department of Electrical and Computer Engineering, University of Maryland, College Park, MD
2003
ABSTRACT
The Java programming language is achieving greater acceptance in high-end embedded systems such as cellphones and PDAs. However, lowend embedded platforms, such as DSPs or microcontrollers, often have no more than a C compiler, and this prevents Java applications from being run on such systems. Applications must either be re-written in C, or a Java Virtual Machine must be ported to each such system.This paper discusses a compiler that converts portable Java bytecode to C code, allowing applications written in Java to run on embedded systems which may lack a Java Virtual Machine. This is also applicable to barebones embedded systems running without an operating system. We briefly describe code generation strategies, run-time data structures and optimization algorithms used to generate efficient C code. The code size and execution time of the C code were compared with interpreted Java, just-in-time compiled Java, and executables generated directly from Java.
On an average, we found the size of the generated stand-alone executable to be over 25 times smaller than that generated by a cutting-edge Javato- native-code compiler, while providing performance comparable to the best of various Java implementation strategies.