Abstract. This article presents a hybrid method of partial evaluation (PE), which is exactly as precise as naive online PE and nearly as efficient as state-of-the-art offline PE, for a statically typed call-by-value functional language. PE is a program transformation that specializes a program with respect to a subset of its input by reducing the program and leaving a residual program. Online PE makes the reduction/residualization decision during specialization, while offline PE makes it before specialization by using a static analysis called binding-time analysis. Compared to offline PE, online PE is more precise in the sense that it finds more redexes, but less efficient in the sense that it takes more time. To solve this dilemma, we begin with a naive online partial evaluator, and make it efficient without sacrificing its precision. To this end, we (1) use state (instead of continuations) for let-insertion, (2) take a so-called cogen approach (instead of self-application), and (3) remove unnecessary let-insertion, unnecessary tags, and unnecessary values/expressions by using a type-based representation analysis, which subsumes various monovariant binding-time analyses. We implemented and compared our method and existing methods---both online and offline---in a subset of Standard ML. Experiments showed that (1) our method produces as fast residual programs as online PE and (2) it does so at least twice as fast as other methods (including a cogen approach to offline PE with a polyvariant binding-time analysis) that produce comparable residual programs.
|
588
|
Compiling with Continuations
– Appel
- 1992
|
|
565
|
Notions of computation and monads
– Moggi
- 1991
|
|
552
|
Partial evaluation and automatic program generation
– Jones, Gomard, et al.
- 1993
|
|
491
|
The Definition of Standard ML (Revised
– Milner, Tofte, et al.
- 1997
|
|
366
|
Deforestation: Transforming programs to eliminate trees
– Wadler
- 1988
|
|
316
|
The polyadic -calculus: a tutorial
– Milner
- 1991
|
|
242
|
Tutorial notes on partial evaluation
– Consel, Danvy
- 1993
|
|
206
|
Higher-order abstract syntax
– Pfenning, Elliot
- 1988
|
|
174
|
Type-directed partial evaluation
– Danvy
- 1996
|
|
134
|
Soft typing
– Cartwright, Fagan
- 1991
|
|
126
|
The polyadic π-calculus: a tutorial
– Milner
- 1991
|
|
118
|
Automatic autoprojection of recursive equations with global variables and abstract data types
– Bondorf, Danvy
- 1991
|
|
116
|
The type and effect discipline
– Talpin, Jouvelot
- 1992
|
|
98
|
Automatic online partial evaluation
– Weise, Conybeare, et al.
|
|
92
|
Representing monads
– Filinski
- 1994
|
|
89
|
Shortcut deforestation in calculational form
– Meijer
- 2002
|
|
85
|
Efficient type inference for higher-order binding-time analysis
– Henglein
|
|
74
|
Once upon a type
– Turner, Wadler, et al.
- 1995
|
|
67
|
Improving binding times without explicit cps-conversion
– Bondorf
- 1992
|
|
54
|
Abstracting Control
– Danvy, Filinski
- 1990
|
|
50
|
Self-Applicable Partial Evaluation
– Bondorf
- 1990
|
|
48
|
Danvy and Andrzej Filinski. Abstracting control
– Olivier
|
|
46
|
Partial evaluation of Standard ML
– Birkedal, Welinder
- 1993
|
|
45
|
Partial evaluation of computation process—an approach to a compiler-compiler
– Futamura
- 1971
|
|
42
|
Controlling Effects
– Filinski
- 1996
|
|
39
|
Polymorphic binding-time analysis
– Henglein, Mossin
- 1994
|
|
37
|
Encoding types in ML-like languages
– Yang
- 1998
|
|
33
|
Polyvariant binding-time analysis for applicative languages
– Consel
- 1993
|
|
33
|
A functional abstraction of typed contexts
– Danvy, Filinski
- 1989
|
|
30
|
Relational interpretations of recursive types in an operational setting
– Birkedal, Harper
- 1997
|
|
29
|
Cogen in Six Lines
– Thiemann
- 1996
|
|
28
|
An empirical and analytic study of stack vs. heap cost for languages with closures
– Appel, Shao
- 1994
|
|
22
|
Effective Specialization of Realistic Programs via Use Sensitivity
– Hornof, Noyé, et al.
- 1997
|
|
19
|
Type-based useless variable elimination
– Kobayashi
- 2000
|
|
18
|
The effectiveness of flow analysis for inlining
– Ashley
- 1997
|
|
18
|
Partial evaluation for higher-order languages with state. Available online from http://www.informatik.uni-freiburg.de/~thiemann/papers/ index.html
– Thiemann, Dussart
- 1996
|
|
17
|
A strongly-typed self-applicable partial evaluator
– Launchbury
- 1991
|
|
15
|
Sound Specialization in the Presence of Computational Effects
– Lawall, Thiemann
- 1997
|
|
12
|
Binding-Time Analysis for Both Static and Dynamic Expressions
– Asai
- 1999
|
|
12
|
Normalization by Evaluation for the Computational Lambda-Calculus
– Filinski
- 2001
|
|
12
|
Combinators for Program Generation
– Thiemann
- 1999
|
|
10
|
A self-applicable partial evaluator for the lambda calculus
– Jones, Gomard, et al.
- 1990
|
|
7
|
Self-Applicable Online Partial Evaluation
– Sperber
- 1996
|
|
6
|
Type-based analysis of usage of values for concurrent programming languages
– Igarashi
- 1997
|
|
5
|
An inverse of the evaluation functional for typed lambda-calculus
– Berger, Schwichtenberg
- 1991
|
|
5
|
A Computational Formalization for Partial Evaluation (Extended Version
– Hatcliff, Danvy
- 1996
|
|
5
|
Online type-directed partial evaluation for dynamically-typed languages
– Sumii, Kobayashi
- 2000
|
|
4
|
Type-Directed Partial Evaluation'. In: Partial Evaluation -- Practice and Theory
– Danvy
- 1999
|
|
4
|
A Self-applicable Partial Evaluator for the Lambda Calculus
– Mogensen
- 1990
|
|
2
|
Online type-directed partial evaluation. Technical Report RS-97-53, Basic Research in Computer Science
– Danvy
- 1997
|