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

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.

[1]  Roy Dz-Ching Ju,et al.  A compiler framework for speculative optimizations , 2004, TACO.

[2]  Thomas W. Reps,et al.  Demand interprocedural dataflow analysis , 1995, SIGSOFT FSE.

[3]  Paul D. Seymour,et al.  Graph minors. III. Planar tree-width , 1984, J. Comb. Theory B.

[4]  Manu Sridharan,et al.  Demand-driven points-to analysis for Java , 2005, OOPSLA '05.

[5]  Mikkel Thorup,et al.  All Structured Programs have Small Tree-Width and Good Register Allocation , 1998, Inf. Comput..

[6]  Andrew W. Appel,et al.  Modern Compiler Implementation in Java , 1997 .

[7]  Edsger W. Dijkstra,et al.  A note on two problems in connexion with graphs , 1959, Numerische Mathematik.

[8]  Ondrej Lhoták,et al.  Practical Extensions to the IFDS Algorithm , 2010, CC.

[9]  Bernhard Steffen,et al.  Parallelism for Free : E cient and Optimal Bitvector Analyses for Parallel Programs , 1996 .

[10]  Torben Hagerup,et al.  Parallel Algorithms with Optimal Speedup for Bounded Treewidth , 1995, SIAM J. Comput..

[11]  Jin Lin,et al.  Data Dependence Profiling for Speculative Optimizations , 2004, CC.

[12]  Krishnendu Chatterjee,et al.  Optimal Dyck reachability for data-dependence and alias analysis , 2017, Proc. ACM Program. Lang..

[13]  Rajeev Alur,et al.  Analysis of recursive state machines , 2001, TOPL.

[14]  Laurie Hendren,et al.  Soot: a Java bytecode optimization framework , 2010, CASCON.

[15]  Bruce A. Reed,et al.  Finding approximate separators and computing tree width quickly , 1992, STOC '92.

[16]  Krishnendu Chatterjee,et al.  Optimal Reachability and a Space-Time Tradeoff for Distance Queries in Constant-Treewidth Graphs , 2016, ESA.

[17]  Xin Zhang,et al.  Hybrid top-down and bottom-up interprocedural analysis , 2014, PLDI.

[18]  Nikolai Tillmann,et al.  SPUR: a trace-based JIT compiler for CIL , 2010, OOPSLA.

[19]  Jakub Lacki Improved Deterministic Algorithms for Decremental Reachability and Strongly Connected Components , 2013, TALG.

[20]  Flemming Nielson,et al.  Principles of Program Analysis , 1999, Springer Berlin Heidelberg.

[21]  Keith D. Cooper,et al.  Engineering a Compiler , 2003 .

[22]  Rami G. Melhem,et al.  Demand-Driven Data Flow Analysis for Communication Optimization , 1997, Parallel Process. Lett..

[23]  Ondrej Lhoták,et al.  Typestate-like analysis of multiple interacting objects , 2008, OOPSLA.

[24]  Robert Giegerich,et al.  Invariance of Approximate Semantics with Respect to Program Transformations , 1981, GI Jahrestagung.

[25]  Hans L. Bodlaender,et al.  A Tourist Guide through Treewidth , 1993, Acta Cybern..

[26]  Linda Torczon,et al.  Interprocedural constant propagation: a study of jump function implementation , 1993, PLDI '93.

[27]  Krishnendu Chatterjee,et al.  The treewidth of smart contracts , 2019, SAC.

[28]  Christos D. Zaroliagis,et al.  Shortest Paths in Digraphs of Small Treewidth. Part I: Sequential Algorithms , 2000, Algorithmica.

[29]  Krishnendu Chatterjee,et al.  Faster Algorithms for Algebraic Path Properties in Recursive State Machines with Constant Treewidth , 2015, POPL.

[30]  Thomas W. Reps,et al.  Precise Interprocedural Dataflow Analysis with Applications to Constant Propagation , 1995, TAPSOFT.

[31]  B. Mohar,et al.  Graph Minors , 2009 .

[32]  Maurizio Martignano A: the Compiler , 2020 .

[33]  Thomas W. Reps,et al.  Program Analysis Using Weighted Pushdown Systems , 2007, FSTTCS.

[34]  Jan Vitek,et al.  Correctness of speculative optimizations with dynamic deoptimization , 2017, Proc. ACM Program. Lang..

[35]  Hans L. Bodlaender,et al.  Discovering Treewidth , 2005, SOFSEM.

[36]  Swarat Chaudhuri,et al.  Subcubic algorithms for recursive state machines , 2008, POPL '08.

[37]  Somesh Jha,et al.  Weighted pushdown systems and their application to interprocedural dataflow analysis , 2003, Sci. Comput. Program..

[38]  Thomas W. Reps,et al.  Precise interprocedural dataflow analysis via graph reachability , 1995, POPL '95.

[39]  Johann Blieberger,et al.  On the Tree Width of Ada Programs , 2004, Ada-Europe.

[40]  Hans L. Bodlaender,et al.  Dynamic Algorithms for Graphs with Treewidth 2 , 1993, WG.

[41]  Thomas W. Reps,et al.  Demand Interprocedural Program Analysis Using Logic Databases , 1993, Workshop on Programming with Logic Databases , ILPS.

[42]  Thomas W. Reps,et al.  Program analysis via graph reachability , 1997, Inf. Softw. Technol..

[43]  Stefan Schwoon,et al.  Model checking pushdown systems , 2002 .

[44]  Hans L. Bodlaender A linear time algorithm for finding tree-decompositions of small treewidth , 1993, STOC '93.

[45]  Thomas A. Henzinger,et al.  Handbook of Model Checking , 2018, Springer International Publishing.

[46]  Rajiv Gupta,et al.  Demand-driven computation of interprocedural data flow , 1995, POPL '95.

[47]  Ken Kennedy,et al.  Interprocedural constant propagation , 1986, SIGP.

[48]  Eugene L. Lawler,et al.  Linear-Time Computation of Optimal Subgraphs of Decomposable Graphs , 1987, J. Algorithms.

[49]  Patrick Cousot,et al.  Static Determination of Dynamic Properties of Recursive Procedures , 1977, Formal Description of Programming Concepts.

[50]  Amer Diwan,et al.  The DaCapo benchmarks: java benchmarking development and analysis , 2006, OOPSLA '06.

[51]  Mehdi Jazayeri,et al.  The method of attributes for data flow analysis , 2004, Acta Informatica.

[52]  Eric Bodden,et al.  Inter-procedural data-flow analysis with IFDS/IDE and Soot , 2012, SOAP '12.

[53]  Robert E. Tarjan,et al.  Fast Algorithms for Finding Nearest Common Ancestors , 1984, SIAM J. Comput..

[54]  R. Halin S-functions for graphs , 1976 .

[55]  Hans L. Bodlaender,et al.  Dynamic Programming on Graphs with Bounded Treewidth , 1988, ICALP.

[56]  Torben Hagerup Dynamic Algorithms for Graphs of Bounded Treewidth , 1997, ICALP.

[57]  Jan Obdrzálek,et al.  Fast Mu-Calculus Model Checking when Tree-Width Is Bounded , 2003, CAV.

[58]  Krishnendu Chatterjee,et al.  Faster Algorithms for Markov Decision Processes with Low Treewidth , 2013, CAV.

[59]  Andreas Jakoby,et al.  Logspace Versions of the Theorems of Bodlaender and Courcelle , 2010, 2010 IEEE 51st Annual Symposium on Foundations of Computer Science.

[60]  Bruno Courcelle,et al.  Graph Rewriting: An Algebraic and Logic Approach , 1991, Handbook of Theoretical Computer Science, Volume B: Formal Models and Sematics.

[61]  Michael A. Bender,et al.  The LCA Problem Revisited , 2000, LATIN.

[62]  Philipp Klaus Krause,et al.  The tree-width of C , 2020, Discret. Appl. Math..

[63]  Bernhard Steffen,et al.  The Interprocedural Coincidence Theorem , 1992, CC.

[64]  Krishnendu Chatterjee,et al.  JTDec: A Tool for Tree Decompositions in Soot , 2017, ATVA.

[65]  Xin-She Yang,et al.  Introduction to Algorithms , 2021, Nature-Inspired Optimization Algorithms.

[66]  Stefan Arnborg,et al.  Linear time algorithms for NP-hard problems restricted to partial k-trees , 1989, Discret. Appl. Math..

[67]  Barbara G. Ryder,et al.  Pointer-induced aliasing: a problem classification , 1991, POPL '91.

[68]  Rajeev Alur,et al.  Modular strategies for recursive game graphs , 2006, Theor. Comput. Sci..

[69]  Hans L. Bodlaender,et al.  A Partial k-Arboretum of Graphs with Bounded Treewidth , 1998, Theor. Comput. Sci..

[70]  F. Kenneth Zadeck,et al.  Incremental data flow analysis in a structured program editor , 1984, SIGPLAN '84.

[71]  Krishnendu Chatterjee,et al.  Mean-Payoff Pushdown Games , 2012, 2012 27th Annual IEEE Symposium on Logic in Computer Science.

[72]  PavlogiannisAndreas,et al.  Faster Algorithms for Dynamic Algebraic Queries in Basic RSMs with Constant Treewidth , 2019 .

[73]  Jens Gustedt,et al.  The Treewidth of Java Programs , 2002, ALENEX.

[74]  Krishnendu Chatterjee,et al.  Quantitative Interprocedural Analysis , 2015, POPL.