Run-Time Program Specialization in Java Bytecode∗

Run-time specialization (RTS) is a technique that efficiently generates specialized programs with respect to runtime values. For efficiently generating specialized programs, RTS constructs compiled native code fragments called templates at compile-time, and generates a specialized program by merely copying the templates. The generated programs are, on the other hand, less efficient, since the technique prevents many optimizations. This study proposes bytecode specialization (BCS), which generates programs in a bytecode language, and then translates the generated bytecode into native code by using Just-In-Time (JIT) compilers. The advantages of BCS are: (1) efficient specialization processes that are similar to RTS, (2) efficient specialized programs thanks to the optimizations of JIT compilers, and (3) independence of source-to-bytecode compilers and of bytecode-to-native compilers thanks to our proposed binding-time analysis, which directly handles bytecode programs. Thus far, we have implemented a BCS system for a Java Virtual Machine subset. Our micro-benchmark shows that BCS with JIT compiler generates a specialized program that runs more than 3-fold faster than the one specialized by traditional RTS techniques, and that our specialization process takes only 610 microseconds.

[1]  Peter Thiemann,et al.  Two for the price of one: composing partial evaluation and compilation , 1997, PLDI '97.

[2]  Peter Lee,et al.  Run-time code generation and modal-ML , 1998, PLDI.

[3]  Frank Yellin,et al.  The Java Virtual Machine Specification , 1996 .

[4]  Charles Consel,et al.  A general approach for run-time specialization and its application to C , 1996, POPL '96.

[5]  Andrew A. Berlin,et al.  Partial Evaluation for Scientific Computing: The Supercomputer Toolkit Experience , 1994, PEPM.

[6]  Erik Ruf,et al.  Specializing shaders , 1995, SIGGRAPH.

[7]  Peter Sestoft,et al.  Partial evaluation and automatic program generation , 1993, Prentice Hall international series in computer science.

[8]  Dawson R. Engler,et al.  DCG: an efficient, retargetable dynamic code generation system , 1994, ASPLOS VI.

[9]  Jonathan C. Hardwick,et al.  Java as an Intermediate Language , 1996 .

[10]  Hidehiko Masuhara,et al.  Architecture Design and Compilation Techniques Using Partial Evaluation in Reflective Concurrent Object-Oriented Languages , 1999 .

[11]  Satoshi Matsuoka,et al.  Compiling away the meta-level in object-oriented concurrent reflective languages using partial evaluation , 1995, OOPSLA.

[12]  Peter Lee,et al.  Lightweight Run-Time Code Generation , 1994, PEPM.

[13]  Peter Lee,et al.  Optimizing ML with run-time code generation , 1996, PLDI '96.

[14]  Yoshihiko Futamura,et al.  Partial Evaluation of Computation Process--An Approach to a Compiler-Compiler , 1999, High. Order Symb. Comput..

[15]  Akinori Yonezawa,et al.  Design and Partial Evaluation of Meta-Objects for a Concurrent Reflective Language , 1998, ECOOP.

[16]  Ali-Reza Adl-Tabatabai,et al.  Fast, effective code generation in a just-in-time Java compiler , 1998, PLDI.