Faster Algorithms for Weighted Recursive State Machines

  • Krishnendu Chatterjee
  • Bernhard KraglEmail author
  • Samarth Mishra
  • Andreas Pavlogiannis
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 10201)


Pushdown systems (PDSs) and recursive state machines (RSMs), which are linearly equivalent, are standard models for interprocedural analysis. Yet RSMs are more convenient as they (a) explicitly model function calls and returns, and (b) specify many natural parameters for algorithmic analysis, e.g., the number of entries and exits. We consider a general framework where RSM transitions are labeled from a semiring and path properties are algebraic with semiring operations, which can model, e.g., interprocedural reachability and dataflow analysis problems.

Our main contributions are new algorithms for several fundamental problems. As compared to a direct translation of RSMs to PDSs and the best-known existing bounds of PDSs, our analysis algorithm improves the complexity for finite-height semirings (that subsumes reachability and standard dataflow properties). We further consider the problem of extracting distance values from the representation structures computed by our algorithm, and give efficient algorithms that distinguish the complexity of a one-time preprocessing from the complexity of each individual query. Another advantage of our algorithm is that our improvements carry over to the concurrent setting, where we improve the best-known complexity for the context-bounded analysis of concurrent RSMs. Finally, we provide a prototype implementation that gives a significant speed-up on several benchmarks from the SLAM/SDV project.


Node Distance Reachability Problem Distance Problem Exit Node Entry Node 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.



This research was supported in part by the Austrian Science Fund (FWF) under grants S11402-N23, S11407-N23, P23499-N23, and Z211-N23, and by the European Research Council (ERC) under grant 279307.


  1. 1.
  2. 2.
  3. 3.
  4. 4.
    Alur, R., Benedikt, M., Etessami, K., Godefroid, P., Reps, T.W., Yannakakis, M.: Analysis of recursive state machines. ACM Trans. Program. Lang. Syst. 27(4), 786–818 (2005)CrossRefGoogle Scholar
  5. 5.
    Alur, R., Bouajjani, A., Esparza, J.: Model checking procedural programs. In: Clarke, E.M., Henzinger, T.A., Veith, H., Bloem, R. (eds.) Handbook of Model Checking. Springer, Heidelberg (2016)Google Scholar
  6. 6.
    Ball, T., Bounimova, E., Levin, V., Kumar, R., Lichtenberg, J.: The static driver verifier research platform. In: Touili, T., Cook, B., Jackson, P. (eds.) CAV 2010. LNCS, vol. 6174, pp. 119–122. Springer, Heidelberg (2010). doi: 10.1007/978-3-642-14295-6_11 CrossRefGoogle Scholar
  7. 7.
    Ball, T., Rajamani, S.K.: Bebop: a symbolic model checker for boolean programs. In: Havelund, K., Penix, J., Visser, W. (eds.) SPIN 2000. LNCS, vol. 1885, pp. 113–130. Springer, Heidelberg (2000). doi: 10.1007/10722468_7 CrossRefGoogle Scholar
  8. 8.
    Bhattacharya, P., Iliofotou, M., Neamtiu, I., Faloutsos, M.: Graph-based analysis and prediction for software evolution. In: ICSE (2012)Google Scholar
  9. 9.
    Bouajjani, A., Esparza, J., Schwoon, S., Strejček, J.: Reachability analysis of multithreaded software with asynchronous communication. In: Sarukkai, S., Sen, S. (eds.) FSTTCS 2005. LNCS, vol. 3821, pp. 348–359. Springer, Heidelberg (2005). doi: 10.1007/11590156_28 CrossRefGoogle Scholar
  10. 10.
    Callahan, D., Cooper, K.D., Kennedy, K., Torczon, L.: Interprocedural constant propagation. In: CC (1986)Google Scholar
  11. 11.
    Chatterjee, K., Ibsen-Jensen, R., Pavlogiannis, A., Goyal, P.: Faster algorithms for algebraic path properties in recursive state machines with constant treewidth. In: POPL (2015)Google Scholar
  12. 12.
    Chatterjee, K., Kragl, B., Mishra, S., Pavlogiannis, A.: Faster algorithms for weighted recursive state machines. Technical report arXiv:1701.04914 [cs.PL] (2017)
  13. 13.
    Chaudhuri, S.: Subcubic algorithms for recursive state machines. In: POPL (2008)Google Scholar
  14. 14.
    Cousot, P., Cousot, R.: Static determination of dynamic properties of recursive procedures. In: IFIP Conference on Formal Description of Programming Concepts (1977)Google Scholar
  15. 15.
    Giegerich, R., Möncke, U., Wilhelm, R.: Invariance of approximate semantics with respect to program transformations. In: Brauer, W. (ed.) ECI 1981, vol. 50, pp. 1–10. Springer, Heidelberg (1981)Google Scholar
  16. 16.
    Grove, D., Torczon, L.: Interprocedural constant propagation: a study of jump function implementation. In: PLDI (1993)Google Scholar
  17. 17.
    Horwitz, S., Reps, T., Sagiv, M.: Demand interprocedural dataflow analysis. SIGSOFT Softw. Eng. Notes 20(4), 104–115 (1995)CrossRefzbMATHGoogle Scholar
  18. 18.
    Knoop, J., Steffen, B.: The interprocedural coincidence theorem. In: Kastens, U., Pfahler, P. (eds.) CC 1992. LNCS, vol. 641, pp. 125–140. Springer, Heidelberg (1992). doi: 10.1007/3-540-55984-1_13 CrossRefGoogle Scholar
  19. 19.
    Knoop, J., Steffen, B., Vollmer, J.: Parallelism for free: efficient and optimal bitvector analyses for parallel programs. ACM Trans. Program. Lang. Syst. 18(3), 268–299 (1996)CrossRefGoogle Scholar
  20. 20.
    Lal, A., Reps, T.: Solving multiple dataflow queries using WPDSs. In: Alpuente, M., Vidal, G. (eds.) SAS 2008. LNCS, vol. 5079, pp. 93–109. Springer, Heidelberg (2008). doi: 10.1007/978-3-540-69166-2_7 CrossRefGoogle Scholar
  21. 21.
    Lal, A., Reps, T.W.: Reducing concurrent analysis under a context bound to sequential analysis. Formal Methods Syst. Des. 35(1), 73–97 (2009)CrossRefzbMATHGoogle Scholar
  22. 22.
    Lal, A., Reps, T., Balakrishnan, G.: Extended weighted pushdown systems. In: Etessami, K., Rajamani, S.K. (eds.) CAV 2005. LNCS, vol. 3576, pp. 434–448. Springer, Heidelberg (2005). doi: 10.1007/11513988_44 CrossRefGoogle Scholar
  23. 23.
    Lal, A., Touili, T., Kidd, N., Reps, T.: Interprocedural analysis of concurrent programs under a context bound. In: Ramakrishnan, C.R., Rehof, J. (eds.) TACAS 2008. LNCS, vol. 4963, pp. 282–298. Springer, Heidelberg (2008). doi: 10.1007/978-3-540-78800-3_20 CrossRefGoogle Scholar
  24. 24.
    Landi, W., Ryder, B.G.: Pointer-induced aliasing: a problem classification. In: POPL (1991)Google Scholar
  25. 25.
    Liberty, E., Zucker, S.W.: The mailman algorithm: a note on matrix-vector multiplication. Inf. Process. Lett. 109(3), 179–182 (2009)MathSciNetCrossRefzbMATHGoogle Scholar
  26. 26.
    Musuvathi, M., Qadeer, S.: Iterative context bounding for systematic testing of multithreaded programs. In: PLDI (2007)Google Scholar
  27. 27.
    Musuvathi, M., Qadeer, S., Ball, T., Basler, G., Nainar, P.A., Neamtiu, I.: Finding and reproducing heisenbugs in concurrent programs. In: OSDI (2008)Google Scholar
  28. 28.
    Myers, G.: A four russians algorithm for regular expression pattern matching. J. ACM 39(2), 430–448 (1992)MathSciNetCrossRefzbMATHGoogle Scholar
  29. 29.
    Qadeer, S., Rehof, J.: Context-bounded model checking of concurrent software. In: Halbwachs, N., Zuck, L.D. (eds.) TACAS 2005. LNCS, vol. 3440, pp. 93–107. Springer, Heidelberg (2005). doi: 10.1007/978-3-540-31980-1_7 CrossRefGoogle Scholar
  30. 30.
    Yu, Q., Guan, X., Zheng, Q., Liu, T., Zhou, J., Li, J.: Calling network: a new method for modeling software runtime behaviors. ACM SIGSOFT Softw. Eng. Notes 40(1), 1–8 (2015)Google Scholar
  31. 31.
    Ramalingam, G.: Context-sensitive synchronization-sensitive analysis is undecidable. ACM Trans. Program. Lang. Syst. 22(2), 416–430 (2000)CrossRefGoogle Scholar
  32. 32.
    Reps, T., Horwitz, S., Sagiv, M.: Precise interprocedural dataflow analysis via graph reachability. In: POPL (1995)Google Scholar
  33. 33.
    Reps, T., Lal, A., Kidd, N.: Program analysis using weighted pushdown systems. In: Arvind, V., Prasad, S. (eds.) FSTTCS 2007. LNCS, vol. 4855, pp. 23–51. Springer, Heidelberg (2007). doi: 10.1007/978-3-540-77050-3_4 CrossRefGoogle Scholar
  34. 34.
    Reps, T.W., Schwoon, S., Jha, S., Melski, D.: Weighted pushdown systems and their application to interprocedural dataflow analysis. Sci. Comput. Program. 58(1–2), 206–263 (2005)MathSciNetCrossRefzbMATHGoogle Scholar
  35. 35.
    Sagiv, M., Reps, T., Horwitz, S.: Precise interprocedural dataflow analysis with applications to constant propagation. Theor. Comput. Sci. 167(1), 131–170 (1996)MathSciNetCrossRefzbMATHGoogle Scholar
  36. 36.
    Schwoon, S.: Model-checking pushdown systems. Ph.D. thesis, Technische Universität München (2002)Google Scholar
  37. 37.
    Williams, R.: Matrix-vector multiplication in sub-quadratic time (some preprocessing required). In: SODA (2007)Google Scholar
  38. 38.
    Williams, V.V.: Multiplying matrices faster than Coppersmith-Winograd. In: STOC (2012)Google Scholar

Copyright information

© Springer-Verlag GmbH Germany 2017

Authors and Affiliations

  • Krishnendu Chatterjee
    • 1
  • Bernhard Kragl
    • 1
    Email author
  • Samarth Mishra
    • 2
  • Andreas Pavlogiannis
    • 1
  1. 1.IST AustriaKlosterneuburgAustria
  2. 2.IIT BombayMumbaiIndia

Personalised recommendations