skip to main content
research-article
Free Access

Faster Algorithms for Dynamic Algebraic Queries in Basic RSMs with Constant Treewidth

Published:13 November 2019Publication History
Skip Abstract Section

Abstract

Interprocedural analysis is at the heart of numerous applications in programming languages, such as alias analysis, constant propagation, and so on. Recursive state machines (RSMs) are standard models for interprocedural analysis. We consider a general framework with RSMs where the transitions are labeled from a semiring and path properties are algebraic with semiring operations. RSMs with algebraic path properties can model interprocedural dataflow analysis problems, the shortest path problem, the most probable path problem, and so on. The traditional algorithms for interprocedural analysis focus on path properties where the starting point is fixed as the entry point of a specific method. In this work, we consider possible multiple queries as required in many applications such as in alias analysis. The study of multiple queries allows us to bring in an important algorithmic distinction between the resource usage of the one-time preprocessing vs for each individual query. The second aspect we consider is that the control flow graphs for most programs have constant treewidth.

Our main contributions are simple and implementable algorithms that support multiple queries for algebraic path properties for RSMs that have constant treewidth. Our theoretical results show that our algorithms have small additional one-time preprocessing but can answer subsequent queries significantly faster as compared to the current algorithmic solutions for interprocedural dataflow analysis. We have also implemented our algorithms and evaluated their performance for performing on-demand interprocedural dataflow analysis on various domains, such as for live variable analysis and reaching definitions, on a standard benchmark set. Our experimental results align with our theoretical statements and show that after a lightweight preprocessing, on-demand queries are answered much faster than the standard existing algorithmic approaches.

References

  1. Noga Alon and Baruch Schieber. 1987. Optimal Preprocessing for Answering On-line Product Queries. Technical Report. Tel Aviv University.Google ScholarGoogle Scholar
  2. R. Alur, M. Benedikt, K. Etessami, P. Godefroid, T. W. Reps, and M. Yannakakis. 2005. Analysis of recursive state machines. ACM Trans. Program. Lang. Syst. (2005).Google ScholarGoogle Scholar
  3. R. Alur, S. La Torre, and P. Madhusudan. 2006. Modular strategies for recursive game graphs. Theor. Comput. Sci. 354, 2 (2006), 230--249. DOI:https://doi.org/10.1016/j.tcs.2005.11.017Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Andrew W. Appel and Jens Palsberg. 2002. Modern Compiler Implementation in Java. Cambridge University Press.Google ScholarGoogle Scholar
  5. Stefan Arnborg and Andrzej Proskurowski. 1989. Linear time algorithms for NP-hard problems restricted to partial k-trees. Discrete Appl. Math. 23, 1 (1989), 11--24. DOI:https://doi.org/10.1016/0166-218X(89)90031-0Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Wayne A. Babich and Mehdi Jazayeri. 1978. The method of attributes for data flow analysis. Acta Inform. 10, 3 (1978).Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Michael Bebenita, Florian Brandner, Manuel Fahndrich, Francesco Logozzo, Wolfram Schulte, Nikolai Tillmann, and Herman Venter. 2010. SPUR: A trace-based JIT compiler for CIL. In Proceedings of the ACM International Conference on Object Oriented Programming Systems Languages and Applications (OOPSLA’10). ACM, 708--725. DOI:https://doi.org/10.1145/1869459.1869517Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Michael A. Bender and Martín Farach-Colton. 2000. The LCA problem revisited. In Proceedings of the Theoretical Informatics (LATIN’00). Springer Berlin.Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. M. W. Bern, E. L Lawler, and A. L Wong. 1987. Linear-time computation of optimal subgraphs of decomposable graphs. J Algorithm 8, 2 (1987), 216--235. DOI:https://doi.org/10.1016/0196-6774(87)90039-3Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Stephen M. Blackburn. 2006. The DaCapo benchmarks: Java benchmarking development and analysis. In Proceedings of the OOPSLA’06.Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Eric Bodden. 2012. Inter-procedural data-flow analysis with IFDS/IDE and soot. In Proceedings of the SOAP’12. ACM, New York, NY.Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Hans L. Bodlaender. 1994. Dynamic algorithms for graphs with treewidth 2. In Graph-Theoretic Concepts in Computer Science. Springer.Google ScholarGoogle Scholar
  13. Hans L. Bodlaender. 2005. Discovering treewidth. In Proceedings of the Theory and Practice of Computer Science (SOFSEM’05). LNCS, Vol. 3381. Springer.Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Hans L. Bodlaender and Torben Hagerup. 1998. Parallel algorithms with optimal speedup for bounded treewidth. SIAM J. Comput. 27, 6 (1998), 1725--1746. DOI:https://doi.org/10.1137/S0097539795289859Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Hans L. Bodlaender. 1988. Dynamic programming on graphs with bounded treewidth. In Proceedings of the ICALP’88. Springer.Google ScholarGoogle ScholarCross RefCross Ref
  16. Hans L. Bodlaender. 1993a. A Linear Time Algorithm for Finding Tree-decompositions of Small Treewidth. In Proceedings of the Twenty-fifth Annual ACM Symposium on Theory of Computing (STOC’93). ACM, 226--234. DOI:https://doi.org/10.1145/167088.167161Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Hans L. Bodlaender. 1993b. A tourist guide through treewidth. Acta Cybern. 11, 1--2 (1993), 1--21. http://cyber.bibl.u-szeged.hu/index.php/actcybern/article/view/3417.Google ScholarGoogle Scholar
  18. Hans L. Bodlaender. 1998. A partial k-arboretum of graphs with bounded treewidth. Theor. Comput. Sci. 209, 1--2 (1998), 1--45. DOI:https://doi.org/10.1016/S0304-3975(97)00228-4Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Bernd Burgstaller, Johann Blieberger, and Bernhard Scholz. 2004. On the tree width of Ada programs. In Proceedings of the Ada-Europe’04, Reliable Software Technologies, Albert Llamosí and Alfred Strohmeier (Eds.). Springer Berlin, 78--90.Google ScholarGoogle ScholarCross RefCross Ref
  20. David Callahan, Keith D. Cooper, Ken Kennedy, and Linda Torczon. 1986. Interprocedural constant propagation. In Proceedings of the CC’86. ACM.Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Krishnendu Chatterjee, Amir Goharshady, and Ehsan Goharshady. 2019. The treewidth of smart contracts. In Proceedings of the SAC’19.Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Krishnendu Chatterjee, Amir Kafshdar Goharshady, and Andreas Pavlogiannis. 2017. JTDec: A tool for tree decompositions in soot. In Automated Technology for Verification and Analysis, Deepak D’Souza and K. Narayan Kumar (Eds.). Springer International Publishing, Cham, 59--66.Google ScholarGoogle Scholar
  23. Krishnendu Chatterjee, Rasmus Ibsen-Jensen, and Andreas Pavlogiannis. 2016. Optimal reachability and a space-time tradeoff for distance queries in constant-treewidth graphs. In Proceedings of the 24th Annual European Symposium on Algorithms (ESA’16). 28:1--28:17.Google ScholarGoogle Scholar
  24. Krishnendu Chatterjee, Rasmus Ibsen-Jensen, Andreas Pavlogiannis, and Prateesh Goyal. 2015a. Faster algorithms for algebraic path properties in recursive state machines with constant treewidth. In Proceedings of the POPL’15. 97--109.Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. K. Chatterjee and J. Lacki. 2013. Faster algorithms for Markov decision processes with low treewidth. In Proceedings of the CAV’13.Google ScholarGoogle Scholar
  26. Krishnendu Chatterjee, Andreas Pavlogiannis, and Yaron Velner. 2015b. Quantitative interprocedural analysis. In Proceedings of the POPL’15.Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. Krishnendu Chatterjee and Yaron Velner. 2012. Mean-payoff pushdown games. In Proceedings of the LICS’12.Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. Swarat Chaudhuri. 2008. Subcubic algorithms for recursive state machines. In Proceedings of the POPL’08. ACM, New York, NY.Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. Shiva Chaudhuri and Christos D. Zaroliagis. 2000. Shortest paths in digraphs of small treewidth. Part I: Sequential algorithms. Algorithmica 27, 3 (2000), 212--226. DOI:https://doi.org/10.1007/s004530010016Google ScholarGoogle ScholarCross RefCross Ref
  30. Tong Chen, Jin Lin, Xiaoru Dai, Wei-Chung Hsu, and Pen-Chung Yew. 2004. Data dependence profiling for speculative optimizations. In Compiler Construction, Evelyn Duesterwald (Ed.). Springer Berlin, 57--72.Google ScholarGoogle Scholar
  31. Edmund M. Clarke, Thomas A. Henzinger, Helmut Veith, and Roderick Bloem. 2018. Handbook of Model Checking (1st ed.). Springer Publishing Company, Incorporated.Google ScholarGoogle Scholar
  32. Keith Cooper and Linda Torczon. 2011. Engineering a Compiler. Elsevier.Google ScholarGoogle Scholar
  33. T. H. Cormen, C. E. Leiserson, R. L. Rivest, and C. Stein. 2001. Introduction to Algorithms. The MIT Press.Google ScholarGoogle Scholar
  34. Brouno Courcelle. 1990. Graph rewriting: An algebraic and logic approach. In Handbook of Theoretical Computer Science (Vol. B). The MIT Press, Cambridge, MA.Google ScholarGoogle Scholar
  35. P. Cousot and R Cousot. 1977. Static determination of dynamic properties of recursive procedures. In Proceedings of the IFIP’77, Formal Description of Programming Concepts, E. J. Neuhold (Ed.).Google ScholarGoogle Scholar
  36. Edsger. W. Dijkstra. 1959. A note on two problems in connexion with graphs. Numer. Math. 1, 1 (1959), 269--271. DOI:https://doi.org/10.1007/BF01386390Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. Evelyn Duesterwald, Rajiv Gupta, and Mary Lou Soffa. 1995. Demand-driven computation of interprocedural data flow In Proceedings of the POPL’95.Google ScholarGoogle Scholar
  38. M. Elberfeld, A. Jakoby, and T. Tantau. 2010. Logspace versions of the theorems of Bodlaender and Courcelle. In Proceedings of the FOCS’10.Google ScholarGoogle Scholar
  39. Olivier Flückiger, Gabriel Scherer, Ming-Ho Yee, Aviral Goel, Amal Ahmed, and Jan Vitek. 2017. Correctness of speculative optimizations with dynamic deoptimization. Proc. ACM Program. Lang. 2, Article 49 (Dec. 2017), 28 pages. DOI:https://doi.org/10.1145/3158137.Google ScholarGoogle ScholarDigital LibraryDigital Library
  40. Robert Giegerich, Ulrich Möncke, and Reinhard Wilhelm. 1981. Invariance of approximate semantics with respect to program transformations. In Proceedings of the 3rd Conference of the European Co-operation in Informatics (ECI’81).Google ScholarGoogle Scholar
  41. Dan Grove and Linda Torczon. 1993. Interprocedural constant propagation: A study of jump function implementation. In Proceedings of the PLDI’93. ACM.Google ScholarGoogle ScholarDigital LibraryDigital Library
  42. Jens Gustedt, Ole A. Mæhle, and Jan Arne Telle. 2002. The treewidth of Java programs. In Algorithm Engineering and Experiments. Springer.Google ScholarGoogle Scholar
  43. Torben Hagerup. 2000. Dynamic algorithms for graphs of bounded treewidth. Algorithmica (2000).Google ScholarGoogle Scholar
  44. Rudolf Halin. 1976. S-functions for graphs. J. Geom. 8, 1 (1976), 171--186. DOI:https://doi.org/10.1007/BF01917434Google ScholarGoogle ScholarCross RefCross Ref
  45. D. Harel and R. Tarjan. 1984. Fast algorithms for finding nearest common ancestors. SIAM J. Comput. 13, 2 (1984), 338--355. DOI:https://doi.org/10.1137/0213024Google ScholarGoogle ScholarDigital LibraryDigital Library
  46. Susan Horwitz, Thomas Reps, and Mooly Sagiv. 1995. Demand interprocedural dataflow analysis. SIGSOFT Softw. Eng. Notes 20, 4 (1995), 104--115. DOI:https://doi.org/10.1145/222132.222146Google ScholarGoogle ScholarDigital LibraryDigital Library
  47. Philipp Klaus Krause, Lukas Larisch, and Felix Salfelder. 2019. The tree-width of C. Disc. Appl. Math. (03 2019). DOI:https://doi.org/10.1016/j.dam.2019.01.027.Google ScholarGoogle Scholar
  48. Jens Knoop and Bernhard Steffen. 1992. The interprocedural coincidence theorem. In Proceedings of the CC’92.Google ScholarGoogle ScholarCross RefCross Ref
  49. Jens Knoop, Bernhard Steffen, and Jürgen Vollmer. 1996. Parallelism for free: Efficient and optimal bitvector analyses for parallel programs. ACM Trans. Program. Lang. Syst. 18, 3 (1996), 268--299. DOI:https://doi.org/10.1145/229542.229545Google ScholarGoogle ScholarDigital LibraryDigital Library
  50. J. Lacki. 2013. Improved deterministic algorithms for decremental reachability and strongly connected components. ACM Trans. Algor. 9, 3, Article 27 (2013), 15 pages. DOI:https://doi.org/10.1145/2483699.2483707Google ScholarGoogle Scholar
  51. William Landi and Barbara G. Ryder. 1991. Pointer-induced aliasing: A problem classification. In Proceedings of the POPL’91. ACM.Google ScholarGoogle Scholar
  52. Jin Lin, Tong Chen, Wei-Chung Hsu, Pen-Chung Yew, Roy Dz-Ching Ju, Tin-Fook Ngai, and Sun Chan. 2004. A compiler framework for speculative optimizations. ACM Trans. Archit. Code Optim. 1, 3 (Sept. 2004), 247--271. DOI:https://doi.org/10.1145/1022969.1022970.Google ScholarGoogle ScholarDigital LibraryDigital Library
  53. Nomair A. Naeem and Ondrej Lhoták. 2008. Typestate-like analysis of multiple interacting objects. In Proceedings of the OOPSLA’08.Google ScholarGoogle Scholar
  54. Nomair A. Naeem, Ondřej Lhoták, and Jonathan Rodriguez. 2010. Practical extensions to the IFDS algorithm. Proceedings of the CC’10.Google ScholarGoogle ScholarDigital LibraryDigital Library
  55. Flemming Nielson, Hanne R. Nielson, and Chris Hankin. 2015. Principles of Program Analysis. Springer.Google ScholarGoogle ScholarDigital LibraryDigital Library
  56. Jan Obdrzálek. 2003. Fast mu-calculus model checking when tree-width is bounded. In Proceedings of the CAV’03.Google ScholarGoogle ScholarCross RefCross Ref
  57. Bruce A. Reed. 1992. Finding approximate separators and computing tree width quickly. In Proceedings of the STOC’92.Google ScholarGoogle ScholarDigital LibraryDigital Library
  58. Thomas W. Reps. 1995. Demand Interprocedural Program Analysis Using Logic Databases. Springer, 163--196. DOI:https://doi.org/10.1007/978-1-4615-2207-2_8Google ScholarGoogle Scholar
  59. Thomas Reps. 1997. Program analysis via graph reachability. In Proceedings of the ILPS’97.Google ScholarGoogle Scholar
  60. Thomas Reps, Susan Horwitz, and Mooly Sagiv. 1995. Precise interprocedural dataflow analysis via graph reachability. In Proceedings of the POPL’95.Google ScholarGoogle ScholarDigital LibraryDigital Library
  61. Thomas Reps, Akash Lal, and Nick Kidd. 2007. Program analysis using weighted pushdown systems. In Proceedings of the Foundations of Software Technology and Theoretical Computer Science (FSTTCS’07).Google ScholarGoogle ScholarDigital LibraryDigital Library
  62. Thomas Reps, Stefan Schwoon, Somesh Jha, and David Melski. 2005. Weighted pushdown systems and their application to interprocedural dataflow analysis. Sci. Comput. Program. 58, 1 (2005), 206--263. Special Issue on the Static Analysis Symposium 2003. DOI:https://doi.org/10.1016/j.scico.2005.02.009Google ScholarGoogle ScholarDigital LibraryDigital Library
  63. JetBrains ReSharper. 2019. Code inspection: Unused local variable. ReSharper 2019.1 Help. Retrieved from: https://www.jetbrains.com/help/resharper/UnusedVariable.html.Google ScholarGoogle Scholar
  64. Neil Robertson and P. D. Seymour. 1984. Graph minors. III. Planar tree-width. J. Combin. Theor., Series B 36, 1 (1984), 49--64. DOI:https://doi.org/10.1016/0095-8956(84)90013-3Google ScholarGoogle ScholarCross RefCross Ref
  65. Mooly Sagiv, Thomas Reps, and Susan Horwitz. 1996. Precise interprocedural dataflow analysis with applications to constant propagation. Theor. Comput. Sci. 167, 1--2 (1996), 131--170. DOI:https://doi.org/10.1016/0304-3975(96)00072-2Google ScholarGoogle ScholarDigital LibraryDigital Library
  66. Stefan Schwoon. 2002. Model-Checking Pushdown Systems. Ph.D. Dissertation. Technischen Universität München.Google ScholarGoogle Scholar
  67. Manu Sridharan, Denis Gopan, Lexin Shan, and Rastislav Bodík. 2005. Demand-driven points-to analysis for Java. In Proceedings of the OOPSLA’05.Google ScholarGoogle ScholarDigital LibraryDigital Library
  68. Mikkel Thorup. 1998. All structured programs have small tree width and good register allocation. Inform. Comput. 142, 2 (1998), 159--181. DOI:https://doi.org/10.1006/inco.1997.2697Google ScholarGoogle ScholarDigital LibraryDigital Library
  69. Raja Vallée-Rai, Phong Co, Etienne Gagnon, Laurie Hendren, Patrick Lam, and Vijay Sundaresan. 1999. Soot—A Java bytecode optimization framework. In Proceedings of the CASCON’99. IBM Press.Google ScholarGoogle Scholar
  70. Genevieve Warren, Gordon Hogenson, Mike Jones, and Saisang Cai. 2016. CA1804: Remove unused locals. Retrieved from: https://docs.microsoft.com/en-us/visualstudio/code-quality/ca1804-remove-unused-locals?view=vs-2019.Google ScholarGoogle Scholar
  71. Xin Yuan, Rajiv Gupta, and Rami Melhem. 1997. Demand-driven data flow analysis for communication optimization. Parallel Proc. Lett. 7, 4 (1997), 359--370.Google ScholarGoogle ScholarCross RefCross Ref
  72. Frank Kenneth Zadeck. 1984. Incremental data flow analysis in a structured program editor. In Proceedings of the SIGPLAN’84.Google ScholarGoogle ScholarDigital LibraryDigital Library
  73. Xin Zhang, Ravi Mangal, Mayur Naik, and Hongseok Yang. 2014. Hybrid top-down and bottom-up interprocedural analysis. In Proceedings of the PLDI’14.Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Faster Algorithms for Dynamic Algebraic Queries in Basic RSMs with Constant Treewidth

      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

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader

      HTML Format

      View this article in HTML Format .

      View HTML Format
      About Cookies On This Site

      We use cookies to ensure that we give you the best experience on our website.

      Learn more

      Got it!