skip to main content
10.1145/2661088.2661098acmconferencesArticle/Chapter ViewAbstractPublication PagessplashConference Proceedingsconference-collections
research-article

Abstracting abstract control

Published:14 October 2014Publication 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.

Skip Supplemental Material Section

Supplemental Material

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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Ahmed Bouajjani, Javier Esparza, and Oded Maler. Reachability analysis of pushdown automata: Application to model-checking. In CONCUR '97: Concurrency Theory, 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Byeong-Mo Chang. Static check analysis for Java stack inspection. SIGPLAN Notices, 41(3), 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. John Clements and Matthias Felleisen. A tail-recursive machine with stack inspection. ACM Trans. Program. Lang. Syst., 26(6), 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Stephen A. Cook. Linear time simulation of deterministic two-way pushdown automata. In IFIP Congress (1), 1971.Google ScholarGoogle Scholar
  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.Google ScholarGoogle Scholar
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Olivier Danvy. An Analytical Approach to Program as Data Objects . DSc thesis, Department of Computer Science, Aarhus University, 2006.Google ScholarGoogle Scholar
  11. Olivier Danvy and Andrzej Filinski. Abstracting control. In LFP '90: Proceedings of the 1990 ACM conference on LISP and functional programming, 1990. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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.Google ScholarGoogle Scholar
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Matthias Felleisen, Robert B. Findler, and Matthew Flatt. Semantics Engineering with PLT Redex. 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Andrzej Filinski. Representing monads. In Proceedings of the 21st ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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.Google ScholarGoogle ScholarCross RefCross Ref
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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.Google ScholarGoogle ScholarCross RefCross Ref
  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.Google ScholarGoogle ScholarCross RefCross Ref
  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.Google ScholarGoogle Scholar
  22. Oleg Kiselyov. An argument against call/cc, 2012. http://okmij.org/ftp/continuations/against-callcc.html.Google ScholarGoogle Scholar
  23. Oleg Kiselyov and Chung chieh Shan. Delimited continuations in operating systems. In Modeling and Using Context, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Jay McCarthy. Concerning PLT webserver commit 72ec6342ea. private communication.Google ScholarGoogle Scholar
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. Steven S. Muchnick and Neil D. Jones. Program Flow Analysis: Theory and Applications. Prentice Hall, 1981. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. Christian Queinnec. Continuations and web servers. Higher-Order and Symbolic Computation, 17(4), 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. Olin G. Shivers. Control-Flow Analysis of Higher-Order Languages. PhD thesis, Carnegie Mellon University, 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. David Van Horn and Matthew Might. Abstracting abstract machines. In Proceedings of the 15th ACM SIGPLAN International Conference on Functional Programming, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. David Van Horn and Matthew Might. Systematic abstraction of abstract machines. Journal of Functional Programming, 22(Special Issue 4-5), 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. Dimitrios Vardoulakis. CFA2: Pushdown Flow Analysis for Higher-Order Languages. PhD thesis, Northeastern University, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  40. Dimitrios Vardoulakis and Olin Shivers. CFA2: a Context-Free approach to Control-Flow analysis. Logical Methods in Computer Science, 7(2), 2011.Google ScholarGoogle Scholar
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  42. Mark N. Wegman and F. Kenneth Zadeck. Constant propagation with conditional branches. ACM Trans. Program. Lang. Syst., 13(2), 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Abstracting abstract control

    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

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader