Generating Optimized Residual Code in Run-Time Specialization

Run-time specialization (RTS) techniques efficiently generate specialized programs with respect to run-time values. They construct compiled native-code fragments called templates at compile-time, and generate a specialized program by merely copying the templates. The generated programs are less efficient than those generated by static partial evaluation techniques because the RTS techniques prevent many optimizations. The proposed bytecode specialization (BCS) technique is used to generate programs in a bytecode language and then translate the generated bytecode into native code by using a just-in-time (JIT) compiler. Its advantages are (1) efficient specialization processes that are similar to those of RTS techniques, (2) efficient specialized programs thanks to optimizations by the JIT compilers, and (3) that it is independent of the source-to-bytecode and the bytecode-to-native compilers thanks to a binding-time analysis algorithm that directly handles bytecode programs. Thus far, a BCS system has been implemented for a Java virtual machine subset. Micro-benchmarking showed that BCS with JIT compilation generates specialized programs that run more than 3-times faster than ones generated by traditional RTS techniques and that this specialization process takes less than one second.

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

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

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

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

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

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

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

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

[9]  S. Tucker Taft Programming the Internet in Ada 95 , 1996, Ada-Europe.

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

[11]  Dawson R. Engler,et al.  VCODE: a retargetable, extensible, very fast dynamic code generation system , 1996, PLDI '96.

[12]  Nick Benton,et al.  Compiling standard ML to Java bytecodes , 1998, ICFP '98.

[13]  Dawson R. Engler,et al.  tcc: a system for fast, flexible, and high-level dynamic code generation , 1997, PLDI '97.

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

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

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

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

[18]  Hidehiko Masuhara,et al.  On-the-fly Specialization of Reflective Programs Using Dynamic Code Generation Techniques , 1998 .

[19]  Markus Mock,et al.  A retrospective on: "an evaluation of staged run-time optimizations in DyC" , 2004, SIGP.

[20]  Dawson R. Engler,et al.  C and tcc: a language and compiler for dynamic code generation , 1999, TOPL.

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

[22]  Markus Mock,et al.  Annotation-Directed Run-Time Specialization in C , 1997, PEPM.

[23]  Martín Abadi,et al.  A type system for Java bytecode subroutines , 1999, TOPL.

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