Recently, Amtoft presented an analysis and transformation for mapping typed call-by-name programs to call-by-value equivalents. Here, we present a comparable analysis and transformation for untyped programs using dataflow analysis. In the general case, the transformation generates thunks for call site operands of a call-by-name program. Using strictness information derived as part of a larger flow analysis, we can determine that some operands are necessarily evaluated under call-by-name, so the transformation does not need to generate thunks for them. The dataflow analysis is formulated as the solution to a set of constraints. We show that any solution to the constraints is sound, and that any such solution justifies the resulting transformation.
KeywordsParse Tree Free Occurrence Call Site Strictness Analysis Correctness Theorem
Unable to display preview. Download preview PDF.
- 1.Torben Amtoft. Minimal Thunkification. In Patrick Cousot et al., editors, Proc. 3rd International Workshop on Static Analysis (WSA '93), number 724 in Lecture Notes in Computer Science, pages 218–29, Padova, Italy, 1993.Google Scholar
- 2.Geoffrey Burn and Daniel Le Métayer. Proving the Correctness of Compiler Optimisations Based on a Global Program Analysis: A Study of Strictness Analysis. Technical Report TR93-42, Department of Computing, Imperial College of Science, Technology and Medicine, August 1993.Google Scholar
- 5.Paul Hudak and Jonathan Young. Higher-Order Strictness Analysis in Untyped Lambda Calculus. In Conference Record of 13th ACM Symposium on Principles of Programming Languages, pages 97–109, 1986.Google Scholar
- 6.Thomas P. Jensen. Strictness Analysis in Logical Form. In John Hughes, editor, International Conf. on Functional Programming Languages and Computer Architecture, pages 352–66, 1991.Google Scholar
- 7.Tsung-Min Kuo and Prateek Mishra. Strictness Analysis: A New Perspective. In International Conf. on Functional Programming and Computer Architecture, pages 260–72, 1989.Google Scholar
- 8.Alan Mycroft. The Theory and Practice of Transforming Call-by-Need Into Call-by-Value. In B. Robinet, editor, International Symposium on Programming, pages 269–81, 1980.Google Scholar
- 9.Jens Palsberg and Michael I. Schwartzbach. Safety Analysis vs. Type Inference. Information and Computation, to appear.Google Scholar
- 11.Paul Steckler. Correctness of Higher-Order Program Transformations. PhD thesis, College of Computer Science, Northeastern University, July 1994.Google Scholar
- 12.Paul Steckler and Mitchell Wand. Tracking Available Values for Lightweight Closures (Summary). In Neil Jones and Carolyn Talcott, editors, Proc. Atlantique Workshop on Semantics Based Program Manipulation, pages 63–70, 1994. Available as DIKU Report No. 94/12, University of Copenhagen.Google Scholar
- 13.Robert E. Tarjan. Data Structures and Network Algorithms. Society for Industrial and Applied Mathematics, Philadelphia, 1983.Google Scholar
- 14.Mitchell Wand and Paul Steckler. Selective and Lightweight Closure Conversion. In Conference Record of 21st ACM Symposium on Principles of Programming Languages, pages 435–45, 1994.Google Scholar
- 15.David A. Wright. A New Technique for Strictness Analysis. In Proc. TAPSOFT '91, pages 235–58, 1991.Google Scholar