Abstract
The concepts of value- and control-flow graphs are important for program analysis of imperative programs. An imperative value flow graph can be constructed by a single pass over the program text. No similar concepts exist for higher-order languages: we propose a method for constructing value flow graphs for typed higher-order functional languages. A higher-order value flow graph is constructed by a single pass over an explicitly typed program. By using standard methods, single source and single use value flow problems can be answered in linear time and all sources-all uses can be answered in quadratic time (in the size of the flow graph, which is equivalent to the size of the explicitly typed program). On simply typed programs, the precision of the resulting analysis is equivalent to closure analysis [10,11,8]. In practice, it is a reasonable assumption that typed programs are only bigger than their untyped equivalent by a constant factor, hence this is an asymptotic improvement over previous algorithms.
We extend the analysis to handle polymorphism, sum types and recursive types. As a consequence, the analysis can handle (explicit) dynamically typed programs. The analysis is polyvariant for polymorphic definitions.
Preview
Unable to display preview. Download preview PDF.
References
A. Asperti and C. Laneve. Paths, computations and labels in the λ-calculus. In RTA'93, volume 690 of LNCS, pages 152–167. Springer-Verlag, 1993.
A. Ayers. Efficient closure analysis with reachability. In Proc. Workshop on Static Analysis (WSA), Bordeaux, France, pages 126–134, Sept. 1992.
N. Heintze. Control-flow analysis and type systems. In A. Mycroft, editor, Symposium on Static Analysis (SAS), volume 983 of LNCS, pages 189–206, Glasgow, 1995.
N. Heintze and D. McAllester. Control-flow analysis for ML in linear time. In International Conference on Functional Programming (ICFP), 1997. To appear.
F. Henglein. Dynamic typing: Syntax and proof theory. Science of Computer Programming (SCP), 22(3):197–230, 1994.
C. Mossin. Flow Analysis of Typed Higher-Order Programs. PhD thesis, DIKU, University of Copenhagen, January 1997.
C. Mossin. Higher-order value flow graphs. Technical report, DIKU, 1997.
J. Palsberg. Global program analysis in constraint form. In S. Tison, editor, 19th International Colloquium on Trees in Algebra and Programming (CAAP), volume 787 of LNCS, pages 276–290. Springer-Verlag, 1994.
T. Reps, S. Horwitz, and M. Sagiv. Precise interprocedural dataflow analysis via graph reachability. In Conference Record of the 22nd ACM Symposium on Principles of Programming Languages, pages 49–61, San Francisco, CA, Jan. 1995.
P. Sestoft. Replacing function parameters by global variables. Master's thesis, DIKU, University of Copenhagen, Denmark, October 1988.
P. Sestoft. Analysis and Efficient Implementation of Functional Languages. PhD thesis, DIKU, University of Copenhagen, Oct. 1991.
P. Wadler. Theorems for free! In Proc. Functional Programming Languages and Computer Architecture (FPCA), London, England, pages 347–359. ACM Press, Sept. 1989.
Author information
Authors and Affiliations
Editor information
Rights and permissions
Copyright information
© 1997 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Mossin, C. (1997). Higher-order value flow graphs. In: Glaser, H., Hartel, P., Kuchen, H. (eds) Programming Languages: Implementations, Logics, and Programs. PLILP 1997. Lecture Notes in Computer Science, vol 1292. Springer, Berlin, Heidelberg. https://doi.org/10.1007/BFb0033843
Download citation
DOI: https://doi.org/10.1007/BFb0033843
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-63398-3
Online ISBN: 978-3-540-69537-0
eBook Packages: Springer Book Archive