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

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

Published: 13 November 2019 Publication History

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.
[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).
[3]
R. Alur, S. La Torre, and P. Madhusudan. 2006. Modular strategies for recursive game graphs. Theor. Comput. Sci. 354, 2 (2006), 230--249.
[4]
Andrew W. Appel and Jens Palsberg. 2002. Modern Compiler Implementation in Java. Cambridge University Press.
[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.
[6]
Wayne A. Babich and Mehdi Jazayeri. 1978. The method of attributes for data flow analysis. Acta Inform. 10, 3 (1978).
[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.
[8]
Michael A. Bender and Martín Farach-Colton. 2000. The LCA problem revisited. In Proceedings of the Theoretical Informatics (LATIN’00). Springer Berlin.
[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.
[10]
Stephen M. Blackburn. 2006. The DaCapo benchmarks: Java benchmarking development and analysis. In Proceedings of the OOPSLA’06.
[11]
Eric Bodden. 2012. Inter-procedural data-flow analysis with IFDS/IDE and soot. In Proceedings of the SOAP’12. ACM, New York, NY.
[12]
Hans L. Bodlaender. 1994. Dynamic algorithms for graphs with treewidth 2. In Graph-Theoretic Concepts in Computer Science. Springer.
[13]
Hans L. Bodlaender. 2005. Discovering treewidth. In Proceedings of the Theory and Practice of Computer Science (SOFSEM’05). LNCS, Vol. 3381. Springer.
[14]
Hans L. Bodlaender and Torben Hagerup. 1998. Parallel algorithms with optimal speedup for bounded treewidth. SIAM J. Comput. 27, 6 (1998), 1725--1746.
[15]
Hans L. Bodlaender. 1988. Dynamic programming on graphs with bounded treewidth. In Proceedings of the ICALP’88. Springer.
[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.
[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.
[18]
Hans L. Bodlaender. 1998. A partial k-arboretum of graphs with bounded treewidth. Theor. Comput. Sci. 209, 1--2 (1998), 1--45.
[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.
[20]
David Callahan, Keith D. Cooper, Ken Kennedy, and Linda Torczon. 1986. Interprocedural constant propagation. In Proceedings of the CC’86. ACM.
[21]
Krishnendu Chatterjee, Amir Goharshady, and Ehsan Goharshady. 2019. The treewidth of smart contracts. In Proceedings of the SAC’19.
[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.
[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.
[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.
[25]
K. Chatterjee and J. Lacki. 2013. Faster algorithms for Markov decision processes with low treewidth. In Proceedings of the CAV’13.
[26]
Krishnendu Chatterjee, Andreas Pavlogiannis, and Yaron Velner. 2015b. Quantitative interprocedural analysis. In Proceedings of the POPL’15.
[27]
Krishnendu Chatterjee and Yaron Velner. 2012. Mean-payoff pushdown games. In Proceedings of the LICS’12.
[28]
Swarat Chaudhuri. 2008. Subcubic algorithms for recursive state machines. In Proceedings of the POPL’08. ACM, New York, NY.
[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.
[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.
[31]
Edmund M. Clarke, Thomas A. Henzinger, Helmut Veith, and Roderick Bloem. 2018. Handbook of Model Checking (1st ed.). Springer Publishing Company, Incorporated.
[32]
Keith Cooper and Linda Torczon. 2011. Engineering a Compiler. Elsevier.
[33]
T. H. Cormen, C. E. Leiserson, R. L. Rivest, and C. Stein. 2001. Introduction to Algorithms. The MIT Press.
[34]
Brouno Courcelle. 1990. Graph rewriting: An algebraic and logic approach. In Handbook of Theoretical Computer Science (Vol. B). The MIT Press, Cambridge, MA.
[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.).
[36]
Edsger. W. Dijkstra. 1959. A note on two problems in connexion with graphs. Numer. Math. 1, 1 (1959), 269--271.
[37]
Evelyn Duesterwald, Rajiv Gupta, and Mary Lou Soffa. 1995. Demand-driven computation of interprocedural data flow In Proceedings of the POPL’95.
[38]
M. Elberfeld, A. Jakoby, and T. Tantau. 2010. Logspace versions of the theorems of Bodlaender and Courcelle. In Proceedings of the FOCS’10.
[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.
[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).
[41]
Dan Grove and Linda Torczon. 1993. Interprocedural constant propagation: A study of jump function implementation. In Proceedings of the PLDI’93. ACM.
[42]
Jens Gustedt, Ole A. Mæhle, and Jan Arne Telle. 2002. The treewidth of Java programs. In Algorithm Engineering and Experiments. Springer.
[43]
Torben Hagerup. 2000. Dynamic algorithms for graphs of bounded treewidth. Algorithmica (2000).
[44]
Rudolf Halin. 1976. S-functions for graphs. J. Geom. 8, 1 (1976), 171--186.
[45]
D. Harel and R. Tarjan. 1984. Fast algorithms for finding nearest common ancestors. SIAM J. Comput. 13, 2 (1984), 338--355.
[46]
Susan Horwitz, Thomas Reps, and Mooly Sagiv. 1995. Demand interprocedural dataflow analysis. SIGSOFT Softw. Eng. Notes 20, 4 (1995), 104--115.
[47]
Philipp Klaus Krause, Lukas Larisch, and Felix Salfelder. 2019. The tree-width of C. Disc. Appl. Math. (03 2019).
[48]
Jens Knoop and Bernhard Steffen. 1992. The interprocedural coincidence theorem. In Proceedings of the CC’92.
[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.
[50]
J. Lacki. 2013. Improved deterministic algorithms for decremental reachability and strongly connected components. ACM Trans. Algor. 9, 3, Article 27 (2013), 15 pages.
[51]
William Landi and Barbara G. Ryder. 1991. Pointer-induced aliasing: A problem classification. In Proceedings of the POPL’91. ACM.
[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.
[53]
Nomair A. Naeem and Ondrej Lhoták. 2008. Typestate-like analysis of multiple interacting objects. In Proceedings of the OOPSLA’08.
[54]
Nomair A. Naeem, Ondřej Lhoták, and Jonathan Rodriguez. 2010. Practical extensions to the IFDS algorithm. Proceedings of the CC’10.
[55]
Flemming Nielson, Hanne R. Nielson, and Chris Hankin. 2015. Principles of Program Analysis. Springer.
[56]
Jan Obdrzálek. 2003. Fast mu-calculus model checking when tree-width is bounded. In Proceedings of the CAV’03.
[57]
Bruce A. Reed. 1992. Finding approximate separators and computing tree width quickly. In Proceedings of the STOC’92.
[58]
Thomas W. Reps. 1995. Demand Interprocedural Program Analysis Using Logic Databases. Springer, 163--196.
[59]
Thomas Reps. 1997. Program analysis via graph reachability. In Proceedings of the ILPS’97.
[60]
Thomas Reps, Susan Horwitz, and Mooly Sagiv. 1995. Precise interprocedural dataflow analysis via graph reachability. In Proceedings of the POPL’95.
[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).
[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.
[63]
JetBrains ReSharper. 2019. Code inspection: Unused local variable. ReSharper 2019.1 Help. Retrieved from: https://www.jetbrains.com/help/resharper/UnusedVariable.html.
[64]
Neil Robertson and P. D. Seymour. 1984. Graph minors. III. Planar tree-width. J. Combin. Theor., Series B 36, 1 (1984), 49--64.
[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.
[66]
Stefan Schwoon. 2002. Model-Checking Pushdown Systems. Ph.D. Dissertation. Technischen Universität München.
[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.
[68]
Mikkel Thorup. 1998. All structured programs have small tree width and good register allocation. Inform. Comput. 142, 2 (1998), 159--181.
[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.
[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.
[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.
[72]
Frank Kenneth Zadeck. 1984. Incremental data flow analysis in a structured program editor. In Proceedings of the SIGPLAN’84.
[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.

Cited By

View all
  • (2025)Program Analysis via Multiple Context Free Language ReachabilityProceedings of the ACM on Programming Languages10.1145/37048549:POPL(509-538)Online publication date: 9-Jan-2025
  • (2025)Faster Chaitin-like Register Allocation via Grammatical Decompositions of Control-Flow GraphsProceedings of the 30th ACM International Conference on Architectural Support for Programming Languages and Operating Systems, Volume 110.1145/3669940.3707286(463-477)Online publication date: 3-Feb-2025
  • (2024)Fast and Optimal Extraction for Sparse Equality GraphsProceedings of the ACM on Programming Languages10.1145/36898018:OOPSLA2(2551-2577)Online publication date: 8-Oct-2024
  • Show More Cited By

Index Terms

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

      Recommendations

      Comments

      Information & Contributors

      Information

      Published In

      cover image ACM Transactions on Programming Languages and Systems
      ACM Transactions on Programming Languages and Systems  Volume 41, Issue 4
      December 2019
      186 pages
      ISSN:0164-0925
      EISSN:1558-4593
      DOI:10.1145/3366632
      Issue’s Table of Contents
      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: 13 November 2019
      Accepted: 01 September 2019
      Revised: 01 June 2019
      Received: 01 March 2018
      Published in TOPLAS Volume 41, Issue 4

      Permissions

      Request permissions for this article.

      Check for updates

      Author Tags

      1. Interprocedural analysis
      2. constant treewidth graphs
      3. dataflow analysis
      4. reachability and distance oracles
      5. reachability and shortest path

      Qualifiers

      • Research-article
      • Research
      • Refereed

      Funding Sources

      Contributors

      Other Metrics

      Bibliometrics & Citations

      Bibliometrics

      Article Metrics

      • Downloads (Last 12 months)167
      • Downloads (Last 6 weeks)21
      Reflects downloads up to 11 Feb 2025

      Other Metrics

      Citations

      Cited By

      View all
      • (2025)Program Analysis via Multiple Context Free Language ReachabilityProceedings of the ACM on Programming Languages10.1145/37048549:POPL(509-538)Online publication date: 9-Jan-2025
      • (2025)Faster Chaitin-like Register Allocation via Grammatical Decompositions of Control-Flow GraphsProceedings of the 30th ACM International Conference on Architectural Support for Programming Languages and Operating Systems, Volume 110.1145/3669940.3707286(463-477)Online publication date: 3-Feb-2025
      • (2024)Fast and Optimal Extraction for Sparse Equality GraphsProceedings of the ACM on Programming Languages10.1145/36898018:OOPSLA2(2551-2577)Online publication date: 8-Oct-2024
      • (2024)Context-Free Language Reachability via Skewed TabulationProceedings of the ACM on Programming Languages10.1145/36564518:PLDI(1830-1853)Online publication date: 20-Jun-2024
      • (2024)Optimal blocks for maximizing the transaction fee revenue of Bitcoin minersJournal of Combinatorial Optimization10.1007/s10878-024-01249-049:1Online publication date: 19-Dec-2024
      • (2024)Faster Lifetime-Optimal Speculative Partial Redundancy Elimination for Goto-Free ProgramsDependable Software Engineering. Theories, Tools, and Applications10.1007/978-981-96-0602-3_21(382-398)Online publication date: 25-Nov-2024
      • (2023)Exploiting the Sparseness of Control-Flow and Call Graphs for Efficient and On-Demand Algebraic Program AnalysisProceedings of the ACM on Programming Languages10.1145/36228687:OOPSLA2(1993-2022)Online publication date: 16-Oct-2023
      • (2023)The Bounded Pathwidth of Control-Flow GraphsProceedings of the ACM on Programming Languages10.1145/36228077:OOPSLA2(292-317)Online publication date: 16-Oct-2023
      • (2023)Inferring Complexity Bounds from Recurrence RelationsProceedings of the 31st ACM Joint European Software Engineering Conference and Symposium on the Foundations of Software Engineering10.1145/3611643.3617853(2198-2200)Online publication date: 30-Nov-2023
      • (2023)Efficient Interprocedural Data-Flow Analysis Using Treedepth and TreewidthVerification, Model Checking, and Abstract Interpretation10.1007/978-3-031-24950-1_9(177-202)Online publication date: 17-Jan-2023
      • Show More Cited By

      View Options

      View options

      PDF

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader

      HTML Format

      View this article in HTML Format.

      HTML Format

      Login options

      Full Access

      Figures

      Tables

      Media

      Share

      Share

      Share this Publication link

      Share on social media