Interfac-directed partial evaluation

Type-directed partial evaluation (TDPE) is a mechanism for generating specialized programs via ordinary program execution. It was originally developed for functional languages that subsume the lambda-calculus. In this paper, we show how to extend TDPE to work on object-oriented source languages, such as Java, and to generate residual programs directly into low-level representations, such as Java Virtual Machine bytecode. Our approach works for an assignment-free, fully-object-oriented subset of Java (resembling Smalltalk). We give general algorithms for constructing Java code to perform rei cation and re ection, based solely on interface speci cations. Our rei cation algorithm introduces explicit environment management in the residualized code to handle non-local variables. We describe a uniform treatment of primitive types and operations that relies on cross-stage persistence of values. We have implemented a prototype partial evaluator that generates JVM bytecode directly, and then dynamically loads and executes it, thus achieving a \self-improving" executable binary.

[1]  Ulrik Pagh Schultz,et al.  Towards Automatic Specialization of Java Programs , 1999, ECOOP.

[2]  Walid Taha,et al.  Multi-Stage Programming: Axiomatization and Type Safety , 1998, ICALP.

[3]  T. Sheard Integrating Normalization-by-Evaluation into a Staged Programming Language , 1998 .

[4]  Olivier Danvy,et al.  Strong Normalization by Type-Directed Partial Evaluation and Run-Time Code Generation , 1998, Types in Compilation.

[5]  Olivier Danvy Type-Directed Partial Evaluation , 1998, Partial Evaluation.

[6]  Charles Consel,et al.  Harissa: A Flexible and Efficient Java Environment Mixing Bytecode and Compiled Code , 1997, COOTS.

[7]  Peter Thiemann,et al.  Higher-Order Code Splicing , 1999, ESOP.

[8]  Tim Sheard A type-directed, on-line, partial evaluator for a polymorphic language , 1997 .

[9]  Olivier Danvy Online Type-Directed Partial Evaluation , 1998, Fuji International Symposium on Functional and Logic Programming.

[10]  Kristoffer Hogsbro Rose,et al.  Type-Directed Partial Evaluation in Haskell , 1998 .

[11]  Zhe Yang,et al.  Encoding types in ML-like languages , 1998, ICFP '98.

[12]  Walid Taha,et al.  Multi-stage programming with explicit annotations , 1997 .

[13]  Jacques Noyé,et al.  A Uniform Approach for Compile-Time and Run-Time Specialization , 1996, Dagstuhl Seminar on Partial Evaluation.

[14]  Olivier Danvy,et al.  Pragmatic Aspects of Type-Directed Partial Evaluation , 1996 .

[15]  Flemming Nielson,et al.  Two-level functional languages , 1992, Cambridge tracts in theoretical computer science.

[16]  Frank Yellin,et al.  The java virtual machine , 1996 .

[17]  Liwu Li,et al.  The Java Language , 1998 .