The Complexity of Andersen’s Analysis in Practice

  • Manu Sridharan
  • Stephen J. Fink
Part of the Lecture Notes in Computer Science book series (LNCS, volume 5673)

Abstract

While the tightest proven worst-case complexity for Andersen’s points-to analysis is nearly cubic, the analysis seems to scale better on real-world codes. We examine algorithmic factors that help account for this gap. In particular, we show that a simple algorithm can compute Andersen’s analysis in worst-case quadratic time as long as the input program is k-sparse, i.e. it has at most k statements dereferencing each variable and a sparse flow graph. We then argue that for strongly-typed languages like Java, typical structure makes programs likely to be k-sparse, and we give empirical measurements across a suite of Java programs that confirm this hypothesis. We also discuss how various standard implementation techniques yield further constant-factor speedups.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Andersen, L.O.: Program Analysis and Specialization for the C Programming Language. PhD thesis, University of Copenhagen, DIKU (1994)Google Scholar
  2. 2.
  3. 3.
    Berndl, M., Lhoták, O., Qian, F., Hendren, L., Umanee, N.: Points-to analysis using BDDs. In: Conference on Programming Language Design and Implementation (PLDI) (June 2003)Google Scholar
  4. 4.
    Blackburn, S.M., Garner, R., Hoffman, C., Khan, A.M., McKinley, K.S., Bentzur, R., Diwan, A., Feinberg, D., Frampton, D., Guyer, S.Z., Hirzel, M., Hosking, A., Jump, M., Lee, H., Moss, J.E.B., Phansalkar, A., Stefanović, D., VanDrunen, T., von Dincklage, D., Wiedermann, B.: The DaCapo benchmarks: Java benchmarking development and analysis. In: Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA) (2006)Google Scholar
  5. 5.
    Chaudhuri, S.: Subcubic algorithms for recursive state machines. In: POPL 2008: Proceedings of the 35th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languages, pp. 159–169. ACM, New York (2008)Google Scholar
  6. 6.
    Fändrich, M., Foster, J.S., Su, Z., Aiken, A.: Partial online cycle elimination in inclusion constraint graphs. In: Conference on Programming Language Design and Implementation (PLDI), Montreal, Canada (June 1998)Google Scholar
  7. 7.
    Fecht, C., Seidl, H.: Propagating differences: an efficient new fixpoint algorithm for distributive constraint systems. Nordic J. of Computing 5(4), 304–329 (1998)MathSciNetMATHGoogle Scholar
  8. 8.
    Goldsmith, S.F., Aiken, A.S., Wilkerson, D.S.: Measuring empirical computational complexity. In: ESEC-FSE 2007: Proceedings of the the 6th joint meeting of the European software engineering conference and the ACM SIGSOFT symposium on The foundations of software engineering, pp. 395–404. ACM Press, New York (2007)Google Scholar
  9. 9.
    Hardekopf, B., Lin, C.: The ant and the grasshopper: fast and accurate pointer analysis for millions of lines of code. In: PLDI, pp. 290–299 (2007)Google Scholar
  10. 10.
    Heintze, N., McAllester, D.: Linear-time subtransitive control flow analysis. SIGPLAN Not. 32(5), 261–272 (1997)CrossRefGoogle Scholar
  11. 11.
    Heintze, N., McAllester, D.: On the cubic bottleneck in subtyping and flow analysis. In: LICS 1997: Proceedings of the 12th Annual IEEE Symposium on Logic in Computer Science, Washington, DC, USA, 1997, p. 342. IEEE Computer Society, Los Alamitos (1997)Google Scholar
  12. 12.
    Heintze, N., Tardieu, O.: Demand-driven pointer analysis. In: Conference on Programming Language Design and Implementation (PLDI), Snowbird, Utah (June 2001)Google Scholar
  13. 13.
    Heintze, N., Tardieu, O.: Ultra-fast aliasing analysis using CLA: A million lines of C code in a second. In: Conference on Programming Language Design and Implementation (PLDI), Snowbird, Utah (June 2001)Google Scholar
  14. 14.
    Kodumal, J., Aiken, A.: Banshee: A scalable constraint-based analysis toolkit. In: Hankin, C., Siveroni, I. (eds.) SAS 2005. LNCS, vol. 3672, pp. 218–234. Springer, Heidelberg (2005)CrossRefGoogle Scholar
  15. 15.
    Lhoták, O.: Spark: A flexible points-to analysis framework for Java. Master’s thesis, McGill University (December 2002)Google Scholar
  16. 16.
    Lhoták, O., Hendren, L.: Scaling Java points-to analysis using Spark. In: Hedin, G. (ed.) CC 2003. LNCS, vol. 2622, pp. 153–169. Springer, Heidelberg (2003)CrossRefGoogle Scholar
  17. 17.
    Lhoták, O., Hendren, L.: Context-sensitive points-to analysis: Is it worth it? In: Mycroft, A., Zeller, A. (eds.) CC 2006. LNCS, vol. 3923, pp. 47–64. Springer, Heidelberg (2006)CrossRefGoogle Scholar
  18. 18.
    Milanova, A., Rountev, A., Ryder, B.G.: Parameterized object sensitivity for points-to analysis for java. ACM Trans. Softw. Eng. Methodol. 14(1), 1–41 (2005)CrossRefGoogle Scholar
  19. 19.
    Pearce, D.J.: Some directed graph algorithms and their application to pointer analysis. PhD thesis, Imperial College of Science, Technology and Medicine, University of London (2005)Google Scholar
  20. 20.
    Pearce, D.J., Kelly, P.H.J., Hankin, C.: Online cycle detection and difference propagation for pointer analysis. In: Proceedings of the third international IEEE Workshop on Source Code Analysis and Manipulation (2003)Google Scholar
  21. 21.
    Reps, T.: Program analysis via graph reachability. Information and Software Technology 40(11-12), 701–726 (1998)CrossRefGoogle Scholar
  22. 22.
    Rountev, A., Milanova, A., Ryder, B.G.: Points-to analysis for Java using annotated constraints. In: Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA), Tampa Bay, Florida (October 2001)Google Scholar
  23. 23.
    Shivers, O.: Control flow analysis in scheme. In: Conference on Programming Language Design and Implementation (PLDI) (1988)Google Scholar
  24. 24.
    Sridharan, M., Bodík, R.: Refinement-based context-sensitive points-to analysis for Java. In: Conference on Programming Language Design and Implementation (PLDI) (2006)Google Scholar
  25. 25.
    Sridharan, M., Gopan, D., Shan, L., Bodík, R.: Demand-driven points-to analysis for Java. In: Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA) (2005)Google Scholar
  26. 26.
    Steensgaard, B.: Points-to analysis in almost linear time. In: ACM Symposium on Principles of Programming Languages (POPL) (1996)Google Scholar
  27. 27.
    Su, Z., Fähndrich, M., Aiken, A.: Projection merging: Reducing redundancies in inclusion constraint graphs. In: ACM Symposium on Principles of Programming Languages (POPL), Boston, Massachusetts, January 2000, pp. 81–95 (2000)Google Scholar
  28. 28.
    T.J. Watson Libraries for Analysis (WALA), http://wala.sf.net
  29. 29.
    Whaley, J., Lam, M.S.: Cloning-based context-sensitive pointer alias analysis using binary decision diagrams. In: Conference on Programming Language Design and Implementation (PLDI) (2004)Google Scholar
  30. 30.
    Zhu, J., Calman, S.: Symbolic pointer analysis revisited. In: Conference on Programming Language Design and Implementation (PLDI) (2004)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2009

Authors and Affiliations

  • Manu Sridharan
    • 1
  • Stephen J. Fink
    • 1
  1. 1.IBM T.J. Watson Research CenterUSA

Personalised recommendations