Hostname: page-component-8448b6f56d-c47g7 Total loading time: 0 Render date: 2024-04-23T07:19:03.328Z Has data issue: false hasContentIssue false

Type-based flow analysis and context-free language reachability

Published online by Cambridge University Press:  01 October 2008

MANUEL FÄHNDRICH
Affiliation:
One Microsoft Way, Redmond WA 98052, U.S.A. Email: maf@microsoft.com
JAKOB REHOF
Affiliation:
One Microsoft Way, Redmond WA 98052, U.S.A.

Abstract

We present a novel approach to computing the context-sensitive flow of values through procedures and data structures. Our approach combines and extends techniques from two seemingly disparate areas: polymorphic subtyping and interprocedural dataflow analysis based on context-free language reachability. The resulting technique offers several advantages over previous approaches: it works directly on higher-order programs; provides demand-driven interprocedural queries; and improves the asymptotic complexity of a known algorithm based on polymorphic subtyping from O(n8) to O(n3) for computing all queries. For intra-procedural flow restricted to equivalence classes, our algorithm yields linear inter-procedural flow queries.

Type
Paper
Copyright
Copyright © Cambridge University Press 2008

Access options

Get access to the full version of this content by using one of the access options below. (Log in options will check for institutional or personal access. Content may require purchase if you do not have access.)

References

Aiken, A., Wimmers, E. L. and Palsberg, J. (1997) Optimal representations of polymorphic types with subtyping. In: Proceedings of the International Symposium on Theoretical Aspects of Computer Science. Springer-Verlag Lecture Notes in Computer Science 1281 4776.CrossRefGoogle Scholar
Chatterjee, R., Ryder, B. G. and Landi, W. A. (1999) Relevant context inference. In: Conference Record of the 26th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages.CrossRefGoogle Scholar
Curtis, P. (1990) Constrained quantification in polymorphic type analysis. Technical Report CSL-90-1, Xerox Palo Alto Research Center.Google Scholar
Das, M. (2000) Unification-based pointer analysis with directional assignments. In: PLDI '00: Proceedings of the ACM SIGPLAN 2000 Conference on Programming Language Design and Implementation, ACM Press 3546.CrossRefGoogle Scholar
Das, M., Fähndrich, M., Liblit, B. and Rehof, J. (2001) Estimating the impact of scalable pointer analysis on optimization. Technical Report MSR-TR-2001-20, Microsoft Research.CrossRefGoogle Scholar
Dussart, D., Henglein, F. and Mossin, C. (1995a) Polymorphic recursion and subtype qualifications: Polymorphic binding-time analysis in polynomial time. In: Mycroft, A. (ed.) Proc. 2nd Int'l Static Analysis Symposium (SAS), Glasgow, Scotland. Springer-Verlag Lecture Notes in Computer Science 983 118135.CrossRefGoogle Scholar
Dussart, D., Henglein, F. and Mossin, C. (1995b) Polymorphic recursion and subtype qualifications: Polymorphic binding-time analysis in polynomial time. (Unpublished draft.)CrossRefGoogle Scholar
Eifrig, J., Smith, S. and Trifonov, V. (1995) Sound polymorphic type inference for objects. In: Proceedings OOPSLA '95..Google Scholar
Fähndrich, M. and Aiken, A. (1996a) Making set-constraint based program analyses scale. In: First Workshop on Set Constraints at CP'96, Cambridge, MA. (Available as Technical Report CSD-TR-96-917, University of California at Berkeley.)Google Scholar
Fähndrich, M. and Aiken, A. (1996b) Making set-constraint program analyses scale. In: Workshop on Set Constraints, Cambridge MA.Google Scholar
Fähndrich, M., Foster, J. S., Su, Z. and Aiken, A. (1998) Partial online cycle elimination in inclusion constraint graphs. In: Proceedings of the 1998 ACM SIGPLAN Conference on Programming Language Design and Implementation. SIGPLAN notices 33 (5)8596.CrossRefGoogle Scholar
Fähndrich, M., Rehof, J. and Das, M. (2000) Scalable context-sensitive flow analysis using instantiation constraints. In: Programming Language Design and Implementation.CrossRefGoogle Scholar
Fähndrich, M., Rehof, J. and Das, M. (2000) Scalable context-sensitive flow analysis using instantiation constraints. In: Proceedings of the 2000 ACM SIGPLAN Conference on Programming Language Design and Implementation. SIGPLAN notices 253–263.CrossRefGoogle Scholar
Flanagan, C. and Felleisen, M. (1997) Componential set-based analysis. In: Proceedings of the 1997 ACM SIGPLAN Conference on Programming Language Design and Implementation. SIGPLAN notices 32 (6)235248.CrossRefGoogle Scholar
Foster, J. S., Fähndrich, M. and Aiken, A. (2000) Polymorphic versus Monomorphic Flow-insensitive Points-to Analysis for C. In: Proceedings of the 7th International Static Analysis Symposium. Springer-Verlag Lecture Notes in Computer Science 1824.CrossRefGoogle Scholar
Fuh, Y.-C. and Mishra, P. (1988) Type inference with subtypes. In: Proceedings of the 1988 European Symposium on Programming 94–114.CrossRefGoogle Scholar
Fuh, Y.-C. and Mishra, P. (1989) Polymorphic subtype inference: Closing the theory-practice gap. In: Proc. Int'l J't Conf. on Theory and Practice of Software Development 167–183.CrossRefGoogle Scholar
Gustavsson, J. and Svenningsson, J. (2001) Constraint abstractions. In: Program as Data Objects: International Conference on the Theory and Application of Cryptographic Techniques. Springer-Verlag Lecture Notes in Computer Science 2053.CrossRefGoogle Scholar
Heintze, N. (1995) Control-flow analysis and type systems. In: Proceedings SAS '95, Second International Static Analysis Symposium, Glasgow, Scotland. Springer-Verlag Lecture Notes in Computer Science 983 189206.CrossRefGoogle Scholar
Heintze, N. and McAllester, D. (1997) Linear-time subtransitive control flow analysis. In: Proceedings of the 1997 ACM SIGPLAN Conference on Programming Language Design and Implementation. SIGPLAN notices 32 (6)261272.Google Scholar
Henglein, F. (1993) Type inference with polymorphic recursion. ACM Transactions on Programming Languages and Systems 15 (2)253289.CrossRefGoogle Scholar
Horwitz, S., Reps, T. and Sagiv, M. (1995) Demand interprocedural dataflow analysis. In: ACM SIGSOFT Symposium on the Foundations of Software Engineering. ACM SIGSOFT Software Engineering Notes 20 (4)104115.CrossRefGoogle Scholar
Jagannathan, S. and Wright, A. (1995) Effective flow analysis for avoiding run-time checks. In: Proceedings of the 2nd International Static Analysis Symposium. Springer-Verlag Lecture Notes in Computer Science 983 207224.CrossRefGoogle Scholar
Kaes, S. (1992) Type inference in the presence of overloading, subtyping and recursive types. In: Proc. Conf. on LISP and Functional Programming.Google Scholar
Liang, D. and Harrold, M. J. (1999) Efficient points-to analysis for whole-program analysis. In: Proceedings of the 7th European Software Engineering Conference and the 7th ACM SIGSOFT Symposium on the Foundations of Software Engineering.CrossRefGoogle Scholar
Melski, D. and Reps, T. (1997) Interconvertibility of set constraints and context-free language reachability. In: Proceedings of the ACM SIGPLAN Symposium on Partial Evaluation and Semantics-Based Program Manipulation (PEPM-97). ACM SIGPLAN Notices 32 (12)7489.CrossRefGoogle Scholar
Melski, D. and Reps, T. (2000) Interconvertibility of set constraints and context-free language reachability. Theoretical Computer Science 248 (1-2)2998.CrossRefGoogle Scholar
Mitchell, J. C. (1996) Foundations for Programming Languages, MIT Press.Google Scholar
Mossin, C. (1996) Flow Analysis of Typed Higher-Order Programs, Ph.D. thesis, DIKU, Department of Computer Science, University of Copenhagen.Google Scholar
Mycroft, A. (1984) Polymorphic type schemes and recursive definitions. In: Proceedings of the 6th International Symposium on Programming 217–228.CrossRefGoogle Scholar
Nielson, F. and Nielson, H. R. (1997) Infinitary control flow analysis: a collecting semantics for closure analysis. In: Conference Record of the 24th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, ACM Press 332345.CrossRefGoogle Scholar
Nielson, F., Nielson, H. R. and Hankin, C. (1999) Principles of Program Analysis, Springer-Verlag.CrossRefGoogle Scholar
O'Callahan, R. and Jackson, D. (1997) Lackwit: A program understanding tool based on type inference. In: International Conference on Software Engineering.CrossRefGoogle Scholar
Palsberg, J. and O'Keefe, P. (1995) A type system equivalent to flow analysis. Transactions on Programming Languages and Systems 17 (4)576599.CrossRefGoogle Scholar
Pessaux, F. (2000) Détection Statique d'Exceptions non Rattrapée en Objective CAML, Ph.D. thesis, Université Pierre et Marie Curie, Paris 6. (In French.)Google Scholar
Pottier, F. (1996) Simplifying subtyping constraints. In: Proceedings of the SIGPLAN '96 International Conference on Functional Programming (ICFP '96). SIGPLAN notices 31 (6)122133.CrossRefGoogle Scholar
Pottier, F. (1998) Type Inference in the Presence of Subtyping: From Theory to Practice, Ph.D. thesis, Université Paris VII.Google Scholar
Pottier, F. and Rémy, D. (2005) The Essence of ML Type Inference. In: Pierce, B. (ed.) Advanced Topics in Types and Programming, MIT Press.Google Scholar
Pratikakis, P., Hicks, M. and Foster, J. S. (2005) Existential Label Flow Inference via CFL Reachability. Technical Report CS-TR-4700, University of Maryland, College Park. (Available at http://hdl.handle.net/1903/3018.)Google Scholar
Rehof, J. (1997) Minimal typings in atomic subtyping. In: Symposium on Principles of Programming Languages.CrossRefGoogle Scholar
Rehof, J. (1998) The Complexity of Simple Subtyping Systems, Ph.D. thesis, Dept. of Computer Science, University of Copenhagen, Denmark.Google Scholar
Rehof, J. and Fähndrich, M. (2001) Type-based flow analysis: From polymorphic subtyping to CFL-reachability. In: Proceedings POPL 2001, 28'th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages.CrossRefGoogle Scholar
Reps, T. (1998) Program analysis via graph reachability. Information and Software Technology 40 (11-12)701726.CrossRefGoogle Scholar
Reps, T. (2000) Undecidability of context-sensitive data-dependence analysis. Transactions on Programming Languages and Systems 22 (1)162186.CrossRefGoogle Scholar
Reps, T., Horwitz, S. and Sagiv, M. (1995) Precise interprocedural dataflow analysis via graph reachability. In: Conference record of POPL '95, 22nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages 49–61.CrossRefGoogle Scholar
Rittri, M. (1995) Deriving dimensions under polymorphic recursion. In: Proceedings of the Conference on Functional Programming Languages and Computer Architecture, ACM Press 147159.Google Scholar
Smith, G. S. (1994) Principal type schemes for functional programs with overloading and subtyping. Science of Computer Programming 23 (2-3)197226.CrossRefGoogle Scholar
Trifonov, V. and Smith, S. (1996) Subtyping constrained types. In: Proceedings of the 3rd International Static Analysis Symposium. Springer-Verlag Lecture Notes in Computer Science 1145.CrossRefGoogle Scholar