Skip to main content

Modularity in Lattices: A Case Study on the Correspondence Between Top-Down and Bottom-Up Analysis

  • Conference paper
  • First Online:
Static Analysis (SAS 2015)

Part of the book series: Lecture Notes in Computer Science ((LNTCS,volume 9291))

Included in the following conference series:

Abstract

Interprocedural analyses are compositional when they compute over-approximations of procedures in a bottom-up fashion. These analyses are usually more scalable than top-down analyses, which compute a different procedure summary for every calling context. However, compositional analyses are rare in practice as it is difficult to develop them with enough precision.

We establish a connection between compositional analyses and modular lattices, which require certain associativity between the lattice join and meet operations, and use it to develop a compositional version of the connection analysis by Ghiya and Hendren. Our version is slightly more conservative than the original top-down analysis in order to meet our modularity requirement. When applied to real-world Java programs our analysis scaled much better than the original top-down version: The top-down analysis times out in the largest two of our five programs, while ours incurred only 2–5% of precision loss in the remaining programs.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    The subscripts p and g are used as mnemonics: \(d_p\) is used to partition a connection set and \(d_g\) to group two connection sets together.

  2. 2.

    For example, let \(d_1 = \{\{x,z\},\{y\}\}\), \(d_2=\{\{x,y\},\{z\}\}\), and \(d_3=\{\{y,z\}, \{x\} \})\). Then \(d_1 \sqcap (d_2 \sqcup d_3) = d_1 \sqcap \{\{ x,y,z \} \} = d_1\), but \((d_1 \sqcap d_2) \sqcup (d_1 \sqcap d_3) = \{ \{ x\},\{y\}, \{z\} \}\).

  3. 3.

    We analyze recursive procedures in a standard way using a fixpoint computation. As a result, a recursive procedure might be analyzed more than once. However, and unlike in top-down analyses, the procedure is analyzed only using a single input, namely \(\iota _{\mathsf {entry}}\), defined in Sect. 5.2.

  4. 4.

    We note that if we only use elements in the analysis which are smaller than all the meet elements, then our analysis would become flow-insensitive. Let \(d,P_1,G_1,P_2,G_2\) be abstract elements such that \(P_1\) and \(P_2\) are modular elements, \(d \sqsubseteq P_1\), \(((d \sqcap P_1) \sqcup G_1) \sqsubseteq P_2\), \(((d \sqcap P_2) \sqcup G_2) \sqsubseteq P_1\). It holds that \(G_1 \sqsubseteq P_2\), \(G_2 \sqsubseteq P_1\), and thus \( (((d \sqcap P_1) \sqcup G_1) \sqcap P_2) \sqcup G_2 = (((d \sqcap P_1) \sqcap P_2) \sqcup G_1) \sqcup G_2 = (d \sqcap P_2 \sqcap P_1) \sqcup G_2 \sqcup G_1 = ((d \sqcap P_2) \sqcup G_2) \sqcap P_1) \sqcup G_1 \ . \) (This is in fact the case if the meet elements are \(\top \).) Note that this would imply that \({[\![{x=null}]\!]^\sharp } \circ {[\![{x = y}]\!]^\sharp } = {[\![{x = y}]\!]^\sharp }\circ {[\![{x=null}]\!]^\sharp }\), which is neither desired nor the case in our analysis.

References

  1. Ball, T., Rajamani, S.: Bebop: a path-sensitive interprocedural dataflow engine. In: PASTE (2001)

    Google Scholar 

  2. Bodden, E.: Inter-procedural data-flow analysis with ifds/ide and soot. In: SOAP (2012)

    Google Scholar 

  3. Calcagno, C., Distefano, D., O’Hearn, P.W., Yang, H.: Compositional shape analysis by means of bi-abduction. J. ACM 58(6), 26 (2011)

    Article  MathSciNet  Google Scholar 

  4. Castelnuovo, G.: Modular lattices for compositional interprocedural analysis. Master’s thesis, School of Computer Science, Tel Aviv University (2012)

    Google Scholar 

  5. Chatterjee, R., Ryder, B.G., Landi, W.: Relevant context inference. In: POPL (1999)

    Google Scholar 

  6. Codish, M., Debray, S., Giacobazzi, R.: Compositional analysis of modular logic programs. In: POPL (1993)

    Google Scholar 

  7. Cousot, P., Cousot, R.: Abstract interpretation: A unified lattice model for static analysis of programs by construction of approximation of fixed points. In: POPL (1977)

    Google Scholar 

  8. Cousot, P., Cousot, R.: Static determination of dynamic properties of recursive procedures. In: Formal Descriptions of Programming Concepts (1978)

    Google Scholar 

  9. Cousot, P., Cousot, R.: Systematic design of program analysis frameworks. In: POPL (1979)

    Google Scholar 

  10. Cousot, P., Cousot, R.: Modular static program analysis. In: CC (2002)

    Google Scholar 

  11. Dillig, I., Dillig, T., Aiken, A., Sagiv, M.: Precise and compact modular procedure summaries for heap manipulating programs. In: PLDI (2011)

    Google Scholar 

  12. Dolby, J., Fink, S., Sridharan, M.: T. J. Watson Libraries for Analysis (2006)

    Google Scholar 

  13. Fischer, C.N., Cytron, R.K., LeBlanc, R.J.: Crafting A Compiler. Addison-Wesley, New York (2009)

    Google Scholar 

  14. Ghiya, R., Hendren, L.: Connection analysis: a practical interprocedural heap analysis for C. IJPP 24(6), 547–578 (1996)

    Google Scholar 

  15. Giacobazzi, R.: Abductive analysis of modular logic programs. JLP 8(4), 457–483 (1998)

    MathSciNet  MATH  Google Scholar 

  16. Giacobazzi, R., Ranzato, F.: The reduced relative power operation on abstract domains. TCS 216(1), 159–211 (1999)

    Article  MathSciNet  MATH  Google Scholar 

  17. Giacobazzi, R., Ranzato, F., Scozzari, F.: Making abstract domains condensing. TOCL 6(1), 33–60 (2005)

    Article  MathSciNet  Google Scholar 

  18. Giacobazzi, R., Scozzari, F.: A logical model for relational abstract domains. TOPLAS 20(5), 1067–1109 (1998)

    Article  Google Scholar 

  19. Gratzer, G.: General Lattice Theory. Birkhauser Verlag, Berlin (1978)

    Book  Google Scholar 

  20. Gulavani, B., Chakraborty, S., Ramalingam, G., Nori, A.: Bottom-up shape analysis using LISF. TOPLAS,33(5) (2011)

    Google Scholar 

  21. Jacobs, D., Langen, A.: Static analysis of logic programs for independent and parallelism. JLP 13(2–3), 291–314 (1992)

    Article  MATH  Google Scholar 

  22. Livshits, V.B., Lam, M.S.: Finding security vulnerabilities in java applications with static analysis. In: USENIX Security (2005)

    Google Scholar 

  23. Madhavan, R., Ramalingam, G., Vaswani, K.: Purity analysis: an abstract interpretation formulation. In: Yahav, E. (ed.) Static Analysis. LNCS, vol. 6887, pp. 7–24. Springer, Heidelberg (2011)

    Chapter  Google Scholar 

  24. Marriott, K., Søndergaard, H.: Precise and efficient groundness analysis for logic programs. LOPLAS 2(1–4), 181–196 (1993)

    Article  Google Scholar 

  25. Müller-Olm, M., Seidl, H.: Precise interprocedural analysis through linear algebra. In: POPL (2004)

    Google Scholar 

  26. Naik, M.: Chord: A program analysis platform for Java (2006)

    Google Scholar 

  27. Reps, T., Horwitz, S., Sagiv, M.: Precise interprocedural dataflow analysis via graph reachability. In: POPL (1995)

    Google Scholar 

  28. Sagiv, M., Reps, T., Horwitz, S.: Precise interprocedural dataflow analysis with applications to constant propagation. TCS 167(1), 131–170 (1996)

    Article  MathSciNet  MATH  Google Scholar 

  29. Sălcianu, A., Rinard, M.: Purity and side effect analysis for java programs. In: Cousot, R. (ed.) VMCAI 2005. LNCS, vol. 3385, pp. 199–215. Springer, Heidelberg (2005)

    Chapter  Google Scholar 

  30. Sharir, M., Pnueli, A.: Two approaches to interprocedural data flow analysis. In: Program Flow Analysis: Theory and Applications (1981)

    Google Scholar 

  31. Simon, A.: Deriving a complete type inference for hindley-milner and vector sizes using expansion. In: PEPM (2013)

    Google Scholar 

  32. Whaley, J., Rinard, M.: Compositional pointer and escape analysis for java programs. In: OOPSLA (1999)

    Google Scholar 

Download references

Acknowledgments

We thank the anonymous referees for their helpful comments. This work was supported by EU FP7 project ADVENT (308830), ERC grant agreement no. [321174-VSSC], Broadcom Foundation and Tel Aviv University Authentication Initiative, DARPA award #FA8750-12-2-0020 and NSF award #1253867.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Noam Rinetzky .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2015 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Castelnuovo, G., Naik, M., Rinetzky, N., Sagiv, M., Yang, H. (2015). Modularity in Lattices: A Case Study on the Correspondence Between Top-Down and Bottom-Up Analysis. In: Blazy, S., Jensen, T. (eds) Static Analysis. SAS 2015. Lecture Notes in Computer Science(), vol 9291. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-662-48288-9_15

Download citation

  • DOI: https://doi.org/10.1007/978-3-662-48288-9_15

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-662-48287-2

  • Online ISBN: 978-3-662-48288-9

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics