skip to main content
research-article

Positive supercompilation for a higher order call-by-value language

Published:21 January 2009Publication History
Skip Abstract Section

Abstract

Previous deforestation and supercompilation algorithms may introduce accidental termination when applied to call-by-value programs. This hides looping bugs from the programmer, and changes the behavior of a program depending on whether it is optimized or not. We present a supercompilation algorithm for a higher-order call-by-value language and we prove that the algorithm both terminates and preserves termination properties. This algorithm utilizes strictness information for deciding whether to substitute or not and compares favorably with previous call-by-name transformations.

References

  1. E. Albert and G. Vidal. The narrowing-driven approach to functional logic program specialization. New Generation Comput, 20 (1): 3--26, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. A. Alimarine and S. Smetsers. Improved fusion for optimizing generics. In Manuel V. Hermenegildo and Daniel Cabeza, editors, Practical Aspects of Declarative Languages, 7th International Symposium, PADL 2005, Long Beach, CA, USA, January 10-11, 2005, Proceedings, volume 3350 of Lecture Notes in Computer Science, pages 203--218. Springer, 2005. ISBN 3-540-24362-3. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. R.M. Burstall and J. Darlington. A transformation system for developing recursive programs. Journal of the ACM, 24 (1): 44--67, January 1977. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. W.-N. Chin. Safe fusion of functional expressions II: Further improvements. J. Funct. Program, 4 (4): 515--555, 1994.Google ScholarGoogle ScholarCross RefCross Ref
  5. O. Chitil. Type-Inference Based Deforestation of Functional Programs. PhD thesis, RWTH Aachen, October 2000.Google ScholarGoogle Scholar
  6. N. Dershowitz. Termination of rewriting. Journal of Symbolic Computation, 3 (1): 69--115, 1987. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Y. Futamura and K. Nogi. Generalized partial computation. In D. Bjørner, A.P. Ershov, and N.D. Jones, editors, Partial Evaluation and Mixed Computation, pages 133--151. Amsterdam: North-Holland, 1988.Google ScholarGoogle Scholar
  8. Y. Futamura, Z. Konishi, and R. Glück. Program transformation system based on generalized partial computation. New Gen. Comput., 20 (1): 75--99, 2002. ISSN 0288-3635. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. N. Ghani and P. Johann. Short cut fusion of recursive programs with computational effects. In P. Achten, P. Koopman, and M. T. Morazán, editors, Draft Proceedings of The Ninth Symposium on Trends in Functional Programming (TFP), number ICIS-R08007, 2008.Google ScholarGoogle Scholar
  10. A. Gill, J. Launchbury, and S.L. Peyton Jones. A short cut to deforestation. In Functional Programming Languages and Computer Architecture, Copenhagen, Denmark, 1993, 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. A. J. Gill. Cheap Deforestation for Non-strict Functional Languages. PhD thesis, Univ. of Glasgow, January 1996.Google ScholarGoogle Scholar
  12. G. W. Hamilton. Higher order deforestation. In PLILP '96: Proceedings of the 8th International Symposium on Programming Languages: Implementations, Logics, and Programs, pages 213--227, London, UK, 1996. Springer-Verlag. ISBN 3-540-61756-6. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. G. W. Hamilton. Higher order deforestation. Fundam. Informaticae, 69 (1-2): 39--61, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. R. Hinze. Generic Programs and Proofs. PhD thesis, Habilitationsschrift, Bonn University, 2000.Google ScholarGoogle Scholar
  15. T. Johnsson. Lambda lifting: Transforming programs to recursive equations. In FPCA, pages 190--203, 1985. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. N.D. Jones, C.K. Gomard, and P. Sestoft. Partial Evaluation and Automatic Program Generation. Englewood Cliffs, NJ: Prentice Hall, 1993. ISBN 0-13-020249-5. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. S. L. Peyton Jones, A. Tolmach, and T. Hoare. Playing by the rules: Rewriting as a practical optimisation technique in GHC. In Ralf Hinze, editor, Proceedings of the 2001 ACM SIGPLAN Haskell Workshop (HW'2001), 2nd September 2001, Firenze, Italy., Electronic Notes in Theoretical Computer Science, Vol 59. Utrecht University, September 28 2001. UU-CS-2001-23.Google ScholarGoogle Scholar
  18. P. A. Jonsson. Positive supercompilation for a higher-order call-by-value language. Licentiate thesis, Luleå University of Technology, Sweden, Jun 2008.Google ScholarGoogle Scholar
  19. P. A. Jonsson and J. Nordlander. Positive Supercompilation for a Higher Order Call-By-Value Language: Extended Proofs. Technical Report 2008:17, Department of Computer science and Electrical engineering, Luleå University of Technology, October 2008.Google ScholarGoogle Scholar
  20. J. Kort. Deforestation of a raytracer. Master's thesis, University of Amsterdam, 1996.Google ScholarGoogle Scholar
  21. J.-L. Lassez, M. Maher, and K. Marriott. Unification revisited. In Jack Minker, editor, Foundations of Deductive Databases and Logic Programming, pages 587--625. Morgan Kaufmann, 1988. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. X. Leroy. The Objective Caml system: Documentation and user's manual, 2008. With D. Doligez, J. Garrigue, D. Rémy, and J. Vouillon. Available from http://caml.inria.fr (1996-2008).Google ScholarGoogle Scholar
  23. S. Marlow and P. Wadler. Deforestation for higher-order functions. In John Launchbury and Patrick M. Sansom, editors, Functional Programming, Workshops in Computing, pages 154--165. Springer, 1992. ISBN 3-540-19820-2. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. S. D. Marlow. Deforestation for Higher-Order Functional Programs. PhD thesis, Department of Computing Science, University of Glasgow, April 27 1995.Google ScholarGoogle Scholar
  25. R. Milner, M. Tofte, R. Harper, and D. MacQueen. The Definition of Standard ML, \rm Revised edition. MIT Press, 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. N. Mitchell and C. Runciman. A supercompiler for core haskell. In O. Chitil et al., editor, Selected Papers from the Proceedings of IFL 2007, volume 5083 of Lecture Notes in Computer Science, pages 147--164. Springer-Verlag, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. P. Narendran and J. Stillman. On the Complexity of Homeomorphic Embeddings. Technical Report 87-8, Computer Science Department, State Univeristy of New York at Albany, March 1987.Google ScholarGoogle Scholar
  28. TimberJ. Nordlander, M. Carlsson, A. Gill, P. Lindgren, and B. von Sydow. The Timber home page, 2008. URL http://www.timber-lang.org.Google ScholarGoogle Scholar
  29. A. Ohori and I. Sasano. Lightweight fusion by fixed point promotion. In POPL '07: Proceedings of the 34th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languages, pages 143--154, New York, NY, USA, 2007. ACM. ISBN 1-59593-575-4. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. W. Partain. The nofib benchmark suite of haskell programs. In John Launchbury and Patrick M. Sansom, editors, Functional Programming, Workshops in Computing, pages 195--202. Springer, 1992. ISBN 3-540-19820-2. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. D. Sands. Proving the correctness of recursion-based automatic program transformations. Theoretical Computer Science, 167 (1-2): 193--233, 30 October 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. D. Sands. From SOS rules to proof principles: An operational metatheory for functional languages. In Proceedings of the 24th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL). ACM Press, January 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. J. P. Secher. Perfect supercompilation. Technical Report DIKU-TR-99/1, Department of Computer Science (DIKU), University of Copenhagen, February 1999.Google ScholarGoogle Scholar
  34. J.P. Secher and M.H. Sørensen. On perfect supercompilation. In D. Bjørner, M. Broy, and A. Zamulin, editors, Proceedings of Perspectives of System Informatics, volume 1755 of Lecture Notes in Computer Science, pages 113--127. Springer-Verlag, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. M.H. Sørensen. Convergence of program transformers in the metric space of trees. Sci. Comput. Program, 37 (1-3): 163--205, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. M.H. Sørensen and R. Glück. An algorithm of generalization in positive supercompilation. In J.W. Lloyd, editor, International Logic Programming Symposium, pages 465--479. Cambridge, MA: MIT Press, 1995.Google ScholarGoogle Scholar
  37. M.H. Sørensen, R. Glück, and N.D. Jones. Towards unifying partial evaluation, deforestation, supercompilation, and GPC. In D. Sannella, editor, Programming Languages and Systems -- ESOP'94. 5th European Symposium on Programming, Edinburgh, U.K., April 1994 (Lecture Notes in Computer Science, vol. 788), pages 485--500. Berlin: Springer-Verlag, 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. M.H. Sørensen, R. Glück, and N.D. Jones. A positive supercompiler. Journal of Functional Programming, 6 (6): 811--838, 1996.Google ScholarGoogle ScholarCross RefCross Ref
  39. J. Svenningsson. Shortcut fusion for accumulating parameters & zip-like functions. In ICFP, pages 124--132, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  40. D. Syme. The F# programming language, Jun 2008. URL http://research.microsoft.com/fsharp.Google ScholarGoogle Scholar
  41. A. Takano. Generalized partial computation for a lazy functional language. In Partial Evaluation and Semantics-Based Program Manipulation, New Haven, Connecticut (Sigplan Notices, vol. 26, no. 9, September 1991), pages 1--11. New York: ACM, 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  42. A. Takano and E. Meijer. Shortcut deforestation in calculational form. In FPCA, pages 306--313, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  43. V.F. Turchin. A supercompiler system based on the language Refal. SIGPLAN Notices, 14 (2): 46--54, February 1979. Google ScholarGoogle ScholarDigital LibraryDigital Library
  44. V.F. Turchin. Semantic definitions in Refal and automatic production of compilers. In N.D. Jones, editor, Semantics-Directed Compiler Generation, Aarhus, Denmark (Lecture Notes in Computer Science, vol. 94), pages 441--474. Berlin: Springer-Verlag, 1980. Google ScholarGoogle ScholarDigital LibraryDigital Library
  45. V.F. Turchin. Program transformation by supercompilation. In H. Ganzinger and N.D. Jones, editors, Programs as Data Objects, Copenhagen, Denmark, 1985 (Lecture Notes in Computer Science, vol. 217), pages 257--281. Berlin: Springer-Verlag, 1986. Google ScholarGoogle ScholarDigital LibraryDigital Library
  46. V.F. Turchin. The concept of a supercompiler. ACM Transactions on Programming Languages and Systems, 8 (3): 292--325, July 1986. Google ScholarGoogle ScholarDigital LibraryDigital Library
  47. V.F. Turchin. Refal-5, Programming Guide & Reference Manual. Holyoke, MA: New England Publishing Co., 1989.Google ScholarGoogle Scholar
  48. P. Wadler. Deforestation: transforming programs to eliminate trees. Theoretical Computer Science, 73 (2): 231--248, June 1990. ISSN 0304-3975. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Positive supercompilation for a higher order call-by-value language

      Recommendations

      Comments

      Login options

      Check if you have access through your login credentials or your institution to get full access on this article.

      Sign in

      Full Access

      • Published in

        cover image ACM SIGPLAN Notices
        ACM SIGPLAN Notices  Volume 44, Issue 1
        POPL '09
        January 2009
        453 pages
        ISSN:0362-1340
        EISSN:1558-1160
        DOI:10.1145/1594834
        Issue’s Table of Contents
        • cover image ACM Conferences
          POPL '09: Proceedings of the 36th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languages
          January 2009
          464 pages
          ISBN:9781605583792
          DOI:10.1145/1480881

        Copyright © 2009 ACM

        Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

        Publisher

        Association for Computing Machinery

        New York, NY, United States

        Publication History

        • Published: 21 January 2009

        Check for updates

        Qualifiers

        • research-article

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader