Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
research-article

Abstracting abstract control

Published: 14 October 2014 Publication History

Abstract

The strength of a dynamic language is also its weakness: run-time flexibility comes at the cost of compile-time predictability. Many of the hallmarks of dynamic languages such as closures, continuations, various forms of reflection, and a lack of static types make many programmers rejoice, while compiler writers, tool developers, and verification engineers lament. The dynamism of these features simply confounds statically reasoning about programs that use them. Consequently, static analyses for dynamic languages are few, far between, and seldom sound.
The "abstracting abstract machines" (AAM) approach to constructing static analyses has recently been proposed as a method to ameliorate the difficulty of designing analyses for such language features. The approach, so called because it derives a function for the sound and computable approximation of program behavior starting from the abstract machine semantics of a language, provides a viable approach to dynamic language analysis since all that is required is a machine description of the interpreter.
The AAM recipe as originally described produces finite state abstractions: the behavior of a program is approximated as a finite state machine. Such a model is inherently imprecise when it comes to reasoning about the control stack of the interpreter: a finite state machine cannot faithfully represent a stack. Recent advances have shown that higher-order programs can be approximated with pushdown systems. However, such models, founded in automata theory, either breakdown or require significant engineering in the face of dynamic language features that inspect or modify the control stack.
In this paper, we tackle the problem of bringing pushdown flow analysis to the domain of dynamic language features. We revise the abstracting abstract machines technique to target the stronger computational model of pushdown systems. In place of automata theory, we use only abstract machines and memoization. As case studies, we show the technique applies to a language with closures, garbage collection, stack-inspection, and first-class composable continuations.

Supplementary Material

ZIP File (dls22.zip)
Install Racket v5.3 or newer, and run any file to see some test programs' abstract traces.

References

[1]
Massimo Bartoletti, Pierpaolo Degano, and Gian L. Ferrari. Stack inspection and secure program transformations. International Journal of Information Security, 2(3-4), 2004.
[2]
Dariusz Biernacki, Olivier Danvy, and Chung-chieh Shan. On the static and dynamic extents of delimited continuations. Science of Computer Programming, 60(3), 2006.
[3]
Ahmed Bouajjani, Javier Esparza, and Oded Maler. Reachability analysis of pushdown automata: Application to model-checking. In CONCUR '97: Concurrency Theory, 1997.
[4]
Byeong-Mo Chang. Static check analysis for Java stack inspection. SIGPLAN Notices, 41(3), 2006.
[5]
John Clements and Matthias Felleisen. A tail-recursive machine with stack inspection. ACM Trans. Program. Lang. Syst., 26(6), 2004.
[6]
Stephen A. Cook. Linear time simulation of deterministic two-way pushdown automata. In IFIP Congress (1), 1971.
[7]
P. Cousot. Abstract interpretation and application to static analysis (invited tutorial). Part I: Basic concepts of abstract interpretation; Part II: Applications of abstract interpretation. In Proc. First IEEE & IFIP International Symposium on Theoretical Aspects of Software Engineering, 2007.
[8]
Patrick Cousot and Radhia Cousot. Abstract interpretation: a unified lattice model for static analysis of programs by construction or approximation of fixpoints. In POPL '77: Proceedings of the 4th ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages, 1977.
[9]
Patrick Cousot, Radhia Cousot, Jerome Feret, Laurent Mauborgne, Antoine Mine, David Monniaux, and Xavier Rival. Varieties of static analyzers: A comparison with Astree, invited paper. In Proc. First IEEE & IFIP International Symposium on Theoretical Aspects of Software Engineering, 2007.
[10]
Olivier Danvy. An Analytical Approach to Program as Data Objects . DSc thesis, Department of Computer Science, Aarhus University, 2006.
[11]
Olivier Danvy and Andrzej Filinski. Abstracting control. In LFP '90: Proceedings of the 1990 ACM conference on LISP and functional programming, 1990.
[12]
Christopher Earl, Matthew Might, and David Van Horn. Pushdown control-flow analysis of higher-order programs. In Workshop on Scheme and Functional Programming, 2010.
[13]
Christopher Earl, Ilya Sergey, Matthew Might, and David Van Horn. Introspective pushdown analysis of higher-order programs. In Proceedings of the 17th ACM SIGPLAN International Conference on Functional Programming, 2012.
[14]
Matthias Felleisen, Robert B. Findler, and Matthew Flatt. Semantics Engineering with PLT Redex. 2009.
[15]
Andrzej Filinski. Representing monads. In Proceedings of the 21st ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, 1994.
[16]
Robert B. Findler and Matthias Felleisen. Contracts for higher-order functions. In ICFP '02: Proceedings of the seventh ACM SIGPLAN International Conference on Functional Programming, 2002.
[17]
Robert Gluck. Simulation of two-way pushdown automata revisited. In Semantics, Abstract Interpretation, and Reasoning about Pro- grams: Essays Dedicated to David A. Schmidt on the Occasion of his Sixtieth Birthday, 2013.
[18]
Dionna Glaze, Nicholas Labich, Matthew Might, and David Van Horn. Optimizing abstract abstract machines. In Proceedings of the 18th ACM SIGPLAN International Conference on Functional Programming, 2013.
[19]
J. Ian Johnson, Ilya Sergey, Christopher Earl, Matthew Might, and David Van Horn. Pushdown flow analysis with abstract garbage collection. Journal of Functional Programming, 24(2-3), 2014.
[20]
Neil D. Jones. A note on linear time simulation of deterministic two-way pushdown automata. Inf. Process. Lett., 6(4):110--112, August 1977.
[21]
Vineeth Kashyap, Kyle Dewey, Ethan A. Kuefner, John Wagner, Kevin Gibbons, John Sarracino, Ben Wiedermann, and Ben Hard- ekopf. JSAI: Designing a sound, configurable, and efficient static analyzer for JavaScript. CoRR, abs/1403.3996, 2014.
[22]
Oleg Kiselyov. An argument against call/cc, 2012. http://okmij.org/ftp/continuations/against-callcc.html.
[23]
Oleg Kiselyov and Chung chieh Shan. Delimited continuations in operating systems. In Modeling and Using Context, 2007.
[24]
George Kuan, David MacQueen, and Robert B. Findler. A rewriting semantics for type inference. In Programming Languages and Systems, 16th European Symposium on Programming, ESOP 2007, volume 4421, 2007.
[25]
Jay McCarthy. Concerning PLT webserver commit 72ec6342ea. private communication.
[26]
Matthew Might and Olin Shivers. Improving flow analyses via CFA: Abstract garbage collection and counting. In Proceedings of the 11th ACM SIGPLAN International Conference on Functional Programming, 2006.
[27]
Matthew Might, Benjamin Chambers, and Olin Shivers. Model checking via CFA. In Proceedings of the 8th International Conference on Verification, Model Checking and Abstract Interpretation, 2007.
[28]
Steven S. Muchnick and Neil D. Jones. Program Flow Analysis: Theory and Applications. Prentice Hall, 1981.
[29]
Hakjoo Oh, Kihong Heo, Wonchan Lee, Woosuk Lee, and Kwangkeun Yi. Design and implementation of sparse global analyses for C-like languages. In Proceedings of the 33rd ACM SIGPLAN Conference on Programming Language Design and Implementation, 2012.
[30]
Christian Queinnec. Continuations and web servers. Higher-Order and Symbolic Computation, 17(4), 2004.
[31]
John H. Reif and Harry R. Lewis. Symbolic evaluation and the global value graph. In Proceedings of the 4th ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages, 1977.
[32]
Thomas Reps, Susan Horwitz, and Mooly Sagiv. Precise interprocedural dataflow analysis via graph reachability. In Proceedings of the 22nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, 1995.
[33]
S. Salvati and I. Walukiewicz. Krivine machines and higher-order schemes. In Proceedings of the 38th International Conference on Automata, Languages and Programming, 2011.
[34]
Stefan Schwoon and Javier Esparza. A note on On-the-Fly verification algorithms. In Tools and Algorithms for the Construction and Analysis of Systems. 2005.
[35]
Olin Shivers and Aaron J. Turon. Modular rollback through control logging: A pair of twin functional pearls. In Proceedings of the 16th ACM SIGPLAN International Conference on Functional Programming, 2011.
[36]
Olin G. Shivers. Control-Flow Analysis of Higher-Order Languages. PhD thesis, Carnegie Mellon University, 1991.
[37]
David Van Horn and Matthew Might. Abstracting abstract machines. In Proceedings of the 15th ACM SIGPLAN International Conference on Functional Programming, 2010.
[38]
David Van Horn and Matthew Might. Systematic abstraction of abstract machines. Journal of Functional Programming, 22(Special Issue 4-5), 2012.
[39]
Dimitrios Vardoulakis. CFA2: Pushdown Flow Analysis for Higher-Order Languages. PhD thesis, Northeastern University, 2012.
[40]
Dimitrios Vardoulakis and Olin Shivers. CFA2: a Context-Free approach to Control-Flow analysis. Logical Methods in Computer Science, 7(2), 2011.
[41]
Dimitrios Vardoulakis and Olin Shivers. Pushdown flow analysis of first-class control. In Proceedings of the 16th ACM SIGPLAN International Conference on Functional Programming, 2011.
[42]
Mark N. Wegman and F. Kenneth Zadeck. Constant propagation with conditional branches. ACM Trans. Program. Lang. Syst., 13(2), 1991.
[43]
Kwangkeun Yi, Hosik Choi, Jaehwang Kim, and Yongdai Kim. An empirical study on classification methods for alarms from a bug-finding static C analyzer. Inf. Process. Lett., 102(2-3), 2007.

Cited By

View all
  • (2016)Scala-AM: A Modular Static Analysis Framework2016 IEEE 16th International Working Conference on Source Code Analysis and Manipulation (SCAM)10.1109/SCAM.2016.14(85-90)Online publication date: Oct-2016
  • (2016)Higher order symbolic execution for contract verification and refutationJournal of Functional Programming10.1017/S095679681600021627Online publication date: 21-Dec-2016
  • (2016)Higher-Order Model Checking in Direct StyleProgramming Languages and Systems10.1007/978-3-319-47958-3_16(295-313)Online publication date: 9-Oct-2016
  • Show More Cited By

Index Terms

  1. Abstracting abstract control

    Recommendations

    Comments

    Information & Contributors

    Information

    Published In

    cover image ACM SIGPLAN Notices
    ACM SIGPLAN Notices  Volume 50, Issue 2
    DLS '14
    February 2015
    146 pages
    ISSN:0362-1340
    EISSN:1558-1160
    DOI:10.1145/2775052
    • Editor:
    • Andy Gill
    Issue’s Table of Contents
    • cover image ACM Conferences
      DLS '14: Proceedings of the 10th ACM Symposium on Dynamic languages
      October 2014
      160 pages
      ISBN:9781450332118
      DOI:10.1145/2661088
    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: 14 October 2014
    Published in SIGPLAN Volume 50, Issue 2

    Check for updates

    Author Tags

    1. abstract interpretation
    2. abstract machines
    3. continuation marks
    4. control-flow analysis
    5. delimited continuations
    6. pushdown analysis

    Qualifiers

    • Research-article

    Funding Sources

    Contributors

    Other Metrics

    Bibliometrics & Citations

    Bibliometrics

    Article Metrics

    • Downloads (Last 12 months)4
    • Downloads (Last 6 weeks)0
    Reflects downloads up to 12 Jan 2025

    Other Metrics

    Citations

    Cited By

    View all
    • (2016)Scala-AM: A Modular Static Analysis Framework2016 IEEE 16th International Working Conference on Source Code Analysis and Manipulation (SCAM)10.1109/SCAM.2016.14(85-90)Online publication date: Oct-2016
    • (2016)Higher order symbolic execution for contract verification and refutationJournal of Functional Programming10.1017/S095679681600021627Online publication date: 21-Dec-2016
    • (2016)Higher-Order Model Checking in Direct StyleProgramming Languages and Systems10.1007/978-3-319-47958-3_16(295-313)Online publication date: 9-Oct-2016
    • (2015)Detecting function purity in JavaScript2015 IEEE 15th International Working Conference on Source Code Analysis and Manipulation (SCAM)10.1109/SCAM.2015.7335406(101-110)Online publication date: Sep-2015
    • (2023)m-CFA Exhibits Perfect Stack PrecisionProgramming Languages and Systems10.1007/978-981-99-8311-7_14(290-309)Online publication date: 21-Nov-2023
    • (2022)Automatically deriving control-flow graph generators from operational semanticsProceedings of the ACM on Programming Languages10.1145/35476486:ICFP(742-771)Online publication date: 31-Aug-2022
    • (2022)Automatically deriving JavaScript static analyzers from specifications using Meta-level static analysisProceedings of the 30th ACM Joint European Software Engineering Conference and Symposium on the Foundations of Software Engineering10.1145/3540250.3549097(1022-1034)Online publication date: 7-Nov-2022
    • (2021)Newly-single and loving it: improving higher-order must-alias analysis with heap fragmentsProceedings of the ACM on Programming Languages10.1145/34736015:ICFP(1-28)Online publication date: 19-Aug-2021
    • (2020)A Set-Based Context Model for Program AnalysisProgramming Languages and Systems10.1007/978-3-030-64437-6_1(3-24)Online publication date: 24-Nov-2020
    • (2020)Liberate Abstract Garbage Collection from the Stack by Decomposing the HeapProgramming Languages and Systems10.1007/978-3-030-44914-8_8(197-223)Online publication date: 27-Apr-2020
    • Show More Cited By

    View Options

    Login options

    View options

    PDF

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader

    Media

    Figures

    Other

    Tables

    Share

    Share

    Share this Publication link

    Share on social media