Integer constraints to stop deforestation

  • Helmut Seidl
Contributed Papers
Part of the Lecture Notes in Computer Science book series (LNCS, volume 1058)


Deforestation is a transformation of functional programs to remove intermediate data structures. It is based on outermost unfolding of function calls where folding is introduced to avoid repeated unfolding of the same expression. Since unrestricted unfolding may encounter arbitrarily many terms, a termination analysis has to determine those subterms where unfolding is possibly dangerous. We show that such an analysis can be obtained from a control flow analysis by an extension with integer constraints — essentially at no loss in efficiency.


  1. [A86]
    N. Andersen: Approximating Term Rewrite Systems by Regular Tree Grammars. Report Nr. 86/16, Data Logisk Institut, Københavns Universitet, 1986Google Scholar
  2. [Ch90]
    Wei-Ngan Chin: Automatic Methods for Program Transformation. Ph.D. Thesis, Imperial College, University of London, July 1990Google Scholar
  3. [Ch94]
    Wei-Ngan Chin: Safe Fusion of Functional Expressions II: Further Improvements. J. of Functional Programming 4. 515–555, 1994Google Scholar
  4. [Co93]
    C. Consel: A Tour of Schism: A Partial Evaluation System for Higher-Order Applicative Languages. Proc. PEPM'93, 2nd ACM SIGPLAN Symp. on Partial Evaluation and Semantics-Based Program Manipulation, 145–154, 1993Google Scholar
  5. [CC95]
    P. Cousot, R. Cousot: Compositional and Inductive Semantic Definitions in Fixpoint, Equational, Constraint, Closure-condition, Rule-based and Game-theoretic Form. Proc. CAV'95, LNCS 939, 293–308, 1995Google Scholar
  6. [De90]
    A. Deutsch: On Determining Lifetime and Aliasing of Dynamically Allocated Data in Higher-Order Functional Specifications. Proc. 17th ACM Symp. on Principles of Programming Languages, 157–168,1990Google Scholar
  7. [FW88]
    A. Ferguson, P. Wadler: When will deforestation stop. In: 1988 Glasgow Workshop on Functional Programming, Research Rep. 89/R4, 1988Google Scholar
  8. [He94]
    N. Heintze: Set-based Analysis of ML Programs. Proc. of the 1994 ACM Conference on Lisp and Functional Programming, 306–317, Lisp Pointers, Orlando, Florida, June 1994Google Scholar
  9. [JM79]
    N.D. Jones, S.S. Muchnick: Flow Analysis of LISP-like Structures. Proc. 6th ACM Symp. on Principles of Programming Languages, 244–256, 1979Google Scholar
  10. [J87]
    N.D. Jones: Flow Analysis of Lazy Higher-Order Functional Programs. In: S. Abramsky, C. Hankin (eds): Abstract Interpretation. Ellis Horwood, 103–122, 1987Google Scholar
  11. [RNN94]
    H. Riis Nielson, F. Nielson: Static and Dynamic Processor Allocation for Higher Order Concurrent Languages. Tech. Report DAIMI PB483, Dept. of Computer Science, Aarhus, 1994; short version in: Proc. TAPSOFT'95Google Scholar
  12. [Pa94]
    J. Palsberg: Closure Analysis in Constraint Form. ACM Transactions on Programming Languages 17, 47–82, 1995 (preliminary version in CAAP'94)Google Scholar
  13. [PO95]
    J. Palsberg, P. O'Keefe: A Type System Equivalent to Flow Analysis. To appear in: ACM Transactions on Programming Languages and Systems, 1995Google Scholar
  14. [PS95]
    J. Palsberg, M.I. Schwarzbach: Safety Analysis versus Type Inference. Inf. and Computation 118, 128–141, 1995Google Scholar
  15. [R69]
    J. C. Reynolds: Automatic Computation of Data Set Definitions. Information Processing, Vol. 68, 456–461, 1969Google Scholar
  16. [Sa95]
    D. Sands: Proving Correctness of Recursion-Based Automatic Program Transformations. Proc. TAPSOFT'95, LNCS, 681–695, 1995Google Scholar
  17. [Se94]
    H. Seidl: Least Solutions of Equations over N. Proc. ICALP'94, LNCS 820, 400–411, 1994Google Scholar
  18. [Sh91]
    O. Shivers. Data-Flow Analysis and Type Recovery in Scheme. In: Peter Lee (ed.): Topics in Advanced Language Implementation. MIT Press, 47–87, 1991Google Scholar
  19. [Sø94a]
    Turchin's Supercompiler Revisited. Master's Thesis. DIKU, University of Copenhagen, March 1994Google Scholar
  20. [Sø94b]
    M.H. Sørensen: A Grammar-based Data-flow Analysis to Stop Deforestation. Proc. CAAP'94, LNCS 787, 335–351, 1994Google Scholar
  21. [SGJ94]
    M.H. Sørensen, R. Glück, N.D. Jones: Towards Unifying Partial Evaluation, Deforestation, Supercompilation and GPC. Proc. ESOP'94, LNCS 788, 485–500, 1994Google Scholar
  22. [Wa88]
    P. Wadler: Deforestation: Transforming Programs to Eliminate Trees. TCS 73, 231–248, 1990; (preliminary version in Proc. ESOP'88, LNCS 300)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1996

Authors and Affiliations

  • Helmut Seidl
    • 1
  1. 1.FB IV - InformatikUniversity TrierTrier

Personalised recommendations