Abstract
Maximally-polyvariant partial evaluation is a strategy for program specialization that propagates static values as accurate as possible. The online partial evaluator presented here achieves this precision in time polynomial in the number of partial-evaluation configurations. This is a significant improvement because a conventional partial evaluator can take exponential time, and no fast algorithm was known for maximally-polyvariant specialization. For an important class of quasi-deterministic specialization problems, our algorithm performs in linear time, even for linear-time specialization of a naive string matcher into a linear-time matcher, which was Futamura’s long-standing open challenge. Our results are presented using a recursive flowchart language.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Notes
- 1.
Multiple return variables; tests are evaluated in the assignment-updated store.
- 2.
A return block that returns to itself halts a program: (spop (return (p) spop)).
References
Ager, M.S., Danvy, O., Rohde, H.K.: Fast partial evaluation of pattern matching in strings. ACM TOPLAS 28(4), 696–714 (2006)
Aho, A.V., Hopcroft, J.E., Ullman, J.D.: Time and tape complexity of pushdown automaton languages. Inf. Control 13(3), 186–206 (1968)
Aho, A.V., Hopcroft, J.E., Ullman, J.D.: The Design and Analysis of Computer Algorithms. Addison-Wesley, Reading (1974)
Alur, R., Bouajjani, A., Esparza, J.: Model checking procedural programs. In: Clarke, E.M., Henzinger, T.A., Veith, H. (eds.) Handbook of Model Checking. Springer, Heidelberg (2016)
Amtoft-Hansen, T., Nikolajsen, T., Träff, J.L., Jones, N.D.: Experiments with implementations of two theoretical constructions. In: Meyer, A.R., Taitslin, M.A. (eds.) Logic at Botik 1989. LNCS, vol. 363, pp. 119–133. Springer, Heidelberg (1989)
Bulyonkov, M.A.: Polyvariant mixed computation for analyzer programs. Acta Informatica 21(5), 473–484 (1984)
Bulyonkov, M.A.: Extracting polyvariant binding time analysis from polyvariant specializer. In: Partial Evaluation and Program Manipulation, pp. 59–65. ACM (1993)
Christensen, N.H., Glück, R.: Offline partial evaluation can be as accurate as online partial evaluation. ACM TOPLAS 26(1), 191–220 (2004)
Consel, C., Danvy, O.: Partial evaluation of pattern matching in strings. Inf. Process. Lett. 30(2), 79–86 (1989)
Cook, S.A.: Linear time simulation of deterministic two-way pushdown automata. In: Freiman, C.V., Griffith, J.E., Rosenfeld, J.L. (eds.) Information Processing 71, pp. 75–80. North-Holland, Amsterdam (1972)
Ershov, A.P.: On the partial computation principle. Inf. Process. Lett. 6(2), 38–41 (1977)
Futamura, Y., Konishi, Z., Glück, R.: Automatic generation of efficient string matching algorithms by generalized partial computation. In: Asian Symposium on Partial Evaluation and Program Manipulation, pp. 1–8. ACM (2002)
Futamura, Y., Konishi, Z., Glück, R.: Program transformation system based on generalized partial computation. New Gener. Comput. 20(1), 75–99 (2002)
Futamura, Y., Nogi, K.: Generalized partial computation. In: Bjørner, D., Ershov, A.P., Jones, N.D. (eds.) Partial Evaluation and Mixed Computation, North-Holland, pp. 133–151 (1988)
Glück, R.: A self-applicable online partial evaluator for recursive flowchart languages. Softw. Pract. Experience 42(6), 649–673 (2012)
Glück, R.: A practical simulation result for two-way pushdown automata. In: Han, Y.-S., Salomaa, K. (eds.) Implementation and Application of Automata. LNCS, vol. 9705. Springer, Heidelberg (2016)
Glück, R., Jørgensen, J.: Generating transformers for deforestation and supercompilation. In: LeCharlier, B. (ed.) SAS 1994. LNCS, vol. 864, pp. 432–448. Springer, Heidelberg (1994)
Glück, R., Klimov, A.V.: Occam’s razor in metacomputation: the notion of a perfect process tree. In: Cousot, P., Falaschi, M., Filé, G., Rauzy, A. (eds.) WSA 1993. LNCS, vol. 724, pp. 112–123. Springer, Heidelberg (1993)
Gomard, C.K., Jones, N.D.: Compiler generation by partial evaluation: a case study. Structured Program. 12(3), 123–144 (1991)
Grune, D., Jacobs, C.J.H.: Parsing Techniques: A Practical Guide. Monographs in Computer Science, 2nd edn. Springer, New York (2008)
Hatcliff, J.: An introduction to online and offline partial evaluation using a simple flowchart language. In: Hatcliff, J., Mogensen, T.Æ., Thiemann, P. (eds.) Partial Evaluation 1998. LNCS, vol. 1706, pp. 20–82. Springer, Heidelberg (1999)
Jones, N.D.: A note on linear time simulation of deterministic two-way pushdown automata. Inf. Process. Lett. 6(4), 110–112 (1977)
Jones, N.D.: Automatic program specialization: a re-examination from basic principles. In: Bjørner, D., Ershov, A.P., Jones, N.D. (eds.) Partial Evaluation and Mixed Computation, North-Holland, pp. 225–282 (1988)
Jones, N.D., Gomard, C.K., Sestoft, P.: Partial Evaluation and Automatic Program Generation. Prentice-Hall, Englewood Cliffs (1993)
Knuth, D.E., Morris, J.H., Pratt, V.R.: Fast pattern matching in strings. SIAM J. Comput. 6(2), 323–350 (1977)
Mogensen, T.Æ.: Evolution of partial evaluators: removing inherited limits. In: Danvy, O., Glück, R., Thiemann, P. (eds.) Partial Evaluation. LNCS, vol. 1110, pp. 303–321. Springer, Heidelberg (1996)
Rytter, W.: A simulation result for two-way pushdown automata. Inf. Process. Lett. 16(4), 199–202 (1983)
Sørensen, M.H., Glück, R., Jones, N.D.: A positive supercompiler. J. Funct. Program. 6(6), 811–838 (1996)
Acknowledgments
The author would like to thank Andrei Klimov and the anonymous reviewers for their comments, and Chung-chieh Shan for discussions of parsing. It is a great pleasure to thank Akihiko Takano for providing the author with excellent working conditions at the National Institute of Informatics, Tokyo, and Masami Hagiya and Zhenjiang Hu for their invaluable support.
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2016 Springer International Publishing Switzerland
About this paper
Cite this paper
Glück, R. (2016). Maximally-Polyvariant Partial Evaluation in Polynomial Time. In: Mazzara, M., Voronkov, A. (eds) Perspectives of System Informatics. PSI 2015. Lecture Notes in Computer Science(), vol 9609. Springer, Cham. https://doi.org/10.1007/978-3-319-41579-6_11
Download citation
DOI: https://doi.org/10.1007/978-3-319-41579-6_11
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-319-41578-9
Online ISBN: 978-3-319-41579-6
eBook Packages: Computer ScienceComputer Science (R0)