skip to main content
research-article

Resolving and exploiting the k-CFA paradox: illuminating functional vs. object-oriented program analysis

Published:05 June 2010Publication History
Skip Abstract Section

Abstract

Low-level program analysis is a fundamental problem, taking the shape of "flow analysis" in functional languages and "points-to" analysis in imperative and object-oriented languages. Despite the similarities, the vocabulary and results in the two communities remain largely distinct, with limited cross-understanding. One of the few links is Shivers's k-CFA work, which has advanced the concept of "context-sensitive analysis" and is widely known in both communities.

Recent results indicate that the relationship between the functional and object-oriented incarnations of k-CFA is not as well understood as thought. Van Horn and Mairson proved k-CFA for k ≥ 1 to be EXPTIME-complete; hence, no polynomial-time algorithm can exist. Yet, there are several polynomial-time formulations of context-sensitive points-to analyses in object-oriented languages. Thus, it seems that functional k-CFA may actually be a profoundly different analysis from object-oriented k-CFA. We resolve this paradox by showing that the exact same specification of k-CFA is polynomial-time for object-oriented languages yet exponential-time for functional ones: objects and closures are subtly different, in a way that interacts crucially with context-sensitivity and complexity. This illumination leads to an immediate payoff: by projecting the object-oriented treatment of objects onto closures, we derive a polynomial-time hierarchy of context-sensitive CFAs for functional programs.

References

  1. Andrew W. Appel. Compiling with Continuations. Cambridge University Press, November 1991. ISBN 0-521-41695-7. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Martin Bravenboer and Yannis Smaragdakis. Strictly declarative specification of sophisticated points-to analyses. In OOPSLA'09: 24th annual ACM SIGPLAN conference on Object Oriented Programming, Systems, Languages, and Applications, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Luca Cardelli. Compiling a functional language. In LISP and Functional Programming, pages 208--217, 1984. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Patrick Cousot and Radhia Cousot. Abstract interpretation: A unified lattice model for static analysis of programs by construction or approximation of fixpoints. In Conference Record of the Fourth ACM Symposium on Principles of Programming Languages, pages 238--252. ACM Press, 1977. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Patrick Cousot and Radhia Cousot. Systematic design of program analysis frameworks. In POPL'79: Proceedings of the 6th ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages, pages 269--282. ACM Press, 1979. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Jörgen Gustavsson and Josef Svenningsson. Constraint abstractions. In PADO'01: Proceedings of the Second Symposium on Programs as Data Objects, pages 63--83. Springer-Verlag, 2001. ISBN 3-540-42068-1. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Atsushi Igarashi, Benjamin C. Pierce, and Philip Wadler. Featherweight Java: a minimal core calculus for Java and GJ. ACM Trans. Program. Lang. Syst., 23 (3): 396--450, 2001. ISSN 0164-0925. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Suresh Jagannathan and Stephen Weeks. A unified treatment of flow analysis in higher-order languages. In POPL'95: Proceedings of the 22nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 393--407. ACM, 1995. ISBN 0-89791-692-1. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Ondřej Lhoták. Program Analysis using Binary Decision Diagrams. PhD thesis, McGill University, January 2006.Google ScholarGoogle Scholar
  10. Ondřej Lhoták and Laurie Hendren. Evaluating the benefits of context-sensitive points-to analysis using a BDD-based implementation. ACM Trans. Softw. Eng. Methodol., 18 (1): 1--53, 2008. ISSN 1049-331X. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Jan Midtgaard. Control-flow analysis of functional programs. Technical Report BRICS RS-07-18, DAIMI, Department of Computer Science, University of Aarhus, December 2007. To appear in revised form in ACM Computing Surveys.Google ScholarGoogle ScholarCross RefCross Ref
  12. Matthew Might and Olin Shivers. Environment analysis via Δ-CFA. In POPL'06: Conference record of the 33rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 127--140. ACM, 2006\natexlaba. ISBN 1-59593-027-2. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Matthew Might and Olin Shivers. Improving flow analyses via Γ-CFA: Abstract garbage collection and counting. In ICFP'06: Proceedings of the Eleventh ACM SIGPLAN International Conference on Functional Programming, pages 13--25. ACM, 2006. ISBN 1-59593-309-3. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Christian Mossin. Flow Analysis of Typed Higher-Order Programs. PhD thesis, DIKU, University of Copenhagen, January 1997.Google ScholarGoogle Scholar
  15. Jakob Rehof and Manuel Fähndrich. Type-base flow analysis: from polymorphic subtyping to CFL-reachability. In POPL'01: Proceedings of the 28th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 54--66. ACM, 2001. ISBN 1-58113-336-7. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Olin Shivers. Higher-order control-flow analysis in retrospect: lessons learned, lessons abandoned. In Kathryn S. McKinley, editor, Best of PLDI 1988, volume 39, pages 257--269. ACM, 2004.Google ScholarGoogle Scholar
  17. Olin G. Shivers. Control-Flow Analysis of Higher-Order Languages. PhD thesis, Carnegie Mellon University, 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. David Van Horn and Harry G. Mairson. Relating complexity and precision in control flow analysis. In ICFP'07: Proceedings of the 12th ACM SIGPLAN International Conference on Functional Programming, pages 85--96. ACM, 2007. ISBN 9781-59593-815-2. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. David Van Horn and Harry G. Mairson. Deciding k-CFA is complete for EXPTIME. In ICFP'08: Proceeding of the 13th ACM SIGPLAN International Conference on Functional Programming, pages 275--282. ACM, 2008. ISBN 9781-595-9391-9-7. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Resolving and exploiting the k-CFA paradox: illuminating functional vs. object-oriented program analysis

      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 45, Issue 6
        PLDI '10
        June 2010
        496 pages
        ISSN:0362-1340
        EISSN:1558-1160
        DOI:10.1145/1809028
        Issue’s Table of Contents
        • cover image ACM Conferences
          PLDI '10: Proceedings of the 31st ACM SIGPLAN Conference on Programming Language Design and Implementation
          June 2010
          514 pages
          ISBN:9781450300193
          DOI:10.1145/1806596

        Copyright © 2010 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: 5 June 2010

        Check for updates

        Qualifiers

        • research-article

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader