skip to main content
article
Public Access

Pushdown control-flow analysis for free

Published:11 January 2016Publication History
Skip Abstract Section

Abstract

Traditional control-flow analysis (CFA) for higher-order languages introduces spurious connections between callers and callees, and different invocations of a function may pollute each other's return flows. Recently, three distinct approaches have been published that provide perfect call-stack precision in a computable manner: CFA2, PDCFA, and AAC. Unfortunately, implementing CFA2 and PDCFA requires significant engineering effort. Furthermore, all three are computationally expensive. For a monovariant analysis, CFA2 is in O(2^n), PDCFA is in O(n^6), and AAC is in O(n^8). In this paper, we describe a new technique that builds on these but is both straightforward to implement and computationally inexpensive. The crucial insight is an unusual state-dependent allocation strategy for the addresses of continuations. Our technique imposes only a constant-factor overhead on the underlying analysis and costs only O(n^3) in the monovariant case. We present the intuitions behind this development, benchmarks demonstrating its efficacy, and a proof of the precision of this analysis.

References

  1. P. Cousot and R. Cousot. Static determination of dynamic properties of programs. In Proceedings of the Second International Symposium on Programming, pages 106–130. Paris, France, 1976.Google ScholarGoogle Scholar
  2. P. Cousot and R. Cousot. Abstract interpretation: a unified lattice model for static analysis of programs by construction or approximation of fixpoints. In Proceedings of the 4th ACM SIGACTSIGPLAN Symposium on Principles of Programming Languages, POPL ’77, pages 238–252, New York, NY, USA, Jan. 1977. ACM. doi: 10.1145/512950.512973. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. P. Cousot and R. Cousot. Systematic design of program analysis frameworks. In Proceedings of the 6th ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages, POPL ’79, pages 269–282, New York, NY, USA, Jan. 1979. ACM. doi: 10.1145/567752.567778. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. C. Earl, M. Might, and D. Van Horn. Pushdown control-flow analysis of higher-order programs: Precise, polyvariant and polynomial-time. In Scheme Workshop, August 2010.Google ScholarGoogle Scholar
  5. C. Earl, I. Sergey, M. Might, and D. Van Horn. Introspective pushdown analysis of higher-order programs. In Proceedings of the 17th ACM SIGPLAN International Conference on Functional Programming, ICFP ’12, pages 177–188, New York, NY, USA, Sept. 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. ACM. ISBN 978-1-4503-1054-3. doi: 10.1145/2364527.2364576.Google ScholarGoogle Scholar
  7. C. Flanagan, A. Sabry, B. F. Duba, and M. Felleisen. The essence of compiling with continuations. In Proceedings of the ACM SIGPLAN 1993 Conference on Programming Language Design and Implementation, PLDI ’93, pages 237–247, New York, NY, USA, Aug. 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. ACM. ISBN 0-89791-598-4. doi: 10.1145/155090.155113.Google ScholarGoogle Scholar
  9. J. I. Johnson. AAC complexity analysis discussion. Unpublished correspondence, June 2015.Google ScholarGoogle Scholar
  10. J. I. Johnson and D. Van Horn. Abstracting abstract control. In Proceedings of the 10th ACM Symposium on Dynamic Languages, DLS ’14, pages 11–22, New York, NY, USA, Oct. 2014. ACM. ISBN 978-1-4503-3211-8. doi: 10.1145/2661088.2661098. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. J. I. Johnson, N. Labich, M. Might, and D. Van Horn. Optimizing abstract abstract machines. In Proceedings of the 18th ACM SIGPLAN International Conference on Functional Programming, ICFP ’13, pages 443–454, New York, NY, USA, Sept. 2013. ACM. ISBN 978- 1-4503-2326-0. doi: 10.1145/2500365.2500604. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. J. Midtgaard. Control-flow analysis of functional programs. ACM Computing Surveys (CSUR), 44(3):10:1–10:33, June 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. ISSN 0360-0300. doi: 10.1145/2187671.2187672.Google ScholarGoogle Scholar
  14. M. Might. Environment Analysis of Higher-Order Languages. PhD thesis, Georgia Institute of Technology, Atlanta, GA, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. M. Might. Abstract interpreters for free. In R. Cousot and M. Martel, editors, Proceedings of the Static Analysis Symposium, volume 6337 of Lecture Notes in Computer Science, pages 407–421. Springer Berlin Heidelberg, 2010. ISBN 978-3-642-15768-4. doi: 10.1007/978-3- 642-15769-1_25. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. M. Might, Y. Smaragdakis, and D. Van Horn. Resolving and exploiting the k-CFA paradox: illuminating functional vs. object-oriented program analysis. In Proceedings of the 31st ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI ’10, pages 305–315, New York, NY, USA, June 2010. ACM. ISBN 978-1- 4503-0019-3. doi: 10.1145/1806596.1806631. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. A. Tarski. A lattice-theoretical fixpoint theorem and its applications. Pacific Journal of Mathematics, 5(2):285–309, 1955.Google ScholarGoogle ScholarCross RefCross Ref
  18. D. Van Horn and M. Might. Abstracting abstract machines. In Proceedings of the 15th ACM SIGPLAN International Conference on Functional Programming, ICFP ’10, pages 51–62, New York, NY, USA, Sept. 2010. ACM. ISBN 978-1-60558-794-3. doi: 10.1145/1863543.1863553. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. D. Vardoulakis and O. Shivers. CFA2: A context-free approach to control-flow analysis. In A. D. Gordon, editor, Proceedings of the European Symposium on Programming, volume 6012 of Lecture Notes in Computer Science, pages 570–589. Springer Berlin Heidelberg, 2010. ISBN 978-3-642-11956-9. doi: 10.1007/978-3-642-11957- 6_30. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Pushdown control-flow analysis for free

    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 51, Issue 1
      POPL '16
      January 2016
      815 pages
      ISSN:0362-1340
      EISSN:1558-1160
      DOI:10.1145/2914770
      • Editor:
      • Andy Gill
      Issue’s Table of Contents
      • cover image ACM Conferences
        POPL '16: Proceedings of the 43rd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages
        January 2016
        815 pages
        ISBN:9781450335492
        DOI:10.1145/2837614

      Copyright © 2016 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 the author(s) 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: 11 January 2016

      Check for updates

      Qualifiers

      • article

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader