Deriving escape analysis by abstract interpretation

Abstract

Escape analysis of object-oriented languages approximates the set of objects which do not escape from a given context. If we take a method as context, the non-escaping objects can be allocated on its activation stack; if we take a thread, Java synchronisation locks on such objects are not needed. In this paper, we formalise a basic escape domain \({\mathcal{E}}\) as an abstract interpretation of concrete states, which we then refine into an abstract domain \({\cal ER}\) which is more concrete than \({\mathcal{E}}\) and, hence, leads to a more precise escape analysis than \({\mathcal{E}}\). We provide optimality results for both \({\mathcal{E}}\) and \({\cal ER}\), in the form of Galois insertions from the concrete to the abstract domains and of optimal abstract operations. The Galois insertion property is obtained by restricting the abstract domains to those elements which do not contain garbage, by using an abstract garbage collector. Our implementation of \({\cal ER}\) is hence an implementation of a formally correct escape analyser, able to detect the stack allocatable creation points of Java (bytecode) applications.

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

References

  1. 1.

    Agrawal, G.: Simultaneous Demand-Driven Data-flow and Call Graph Analysis. In: Proc. of the International Conference on Software Maintenance (ICSM’99), pp. 453–462. IEEE Computer Society, Oxford, UK (1999).

    Google Scholar 

  2. 2.

    Aho, A.V., Sethi, R., Ullman, J.D.: Compilers, Principles Techniques and Tools. Addison Wesley Publishing Company (1986).

  3. 3.

    Arnold, K., Gosling, J., Holmes, D.: The Java™ Programming Language. 3rd edn, Addison-Wesley (2000).

  4. 4.

    Bacon, D.F., Sweeney, P.F.: Fast Static Analysis of C++ Virtual Function Calls. In: Proc. of OOPSLA’96, vol. 31(10) of ACM SIGPLAN Notices, pp. 324–341. ACM Press, New York (1996).

    Google Scholar 

  5. 5.

    Blanchet, B.: Escape Analysis: Correctness Proof, Implementation and Experimental Results. In: 25th ACM SIGPLAN-SIGACT Symposium of Principles of Programming Languages (POPL’98), pp. 25–37. ACM Press, San Diego, CA, USA, (1998).

    Google Scholar 

  6. 6.

    Blanchet, B.: Escape Analysis for Java: Theory and Practice. ACM TOPLAS, 25(6), 713–775 (2003).

    MathSciNet  Article  Google Scholar 

  7. 7.

    Bogda, J., Hölzle, U.: Removing Unnecessary Synchronization in Java. In: Proc. of OOPSLA’99, vol. 34(10) of SIGPLAN Notices, pp. 35–46. Denver, Colorado, USA (1999).

  8. 8.

    Bossi, A., Gabbrielli, M., Levi, G., Martelli, M.: The s-Semantics Approach: Theory and Applications. J. Logic. Program. 19/20:149–197, 1994.

    MathSciNet  Article  Google Scholar 

  9. 9.

    Bryant, R.E.: Graph-Based Algorithms for Boolean Function Manipulation. IEEE Trans Comput. 35(8), 677–691 (1986).

    MATH  Google Scholar 

  10. 10.

    Choi, J.-D., Grove, D., Hind, M., Sarkar, V.: Efficient and Precise Modeling of Exceptions for the Analysis of Java Programs. In: Proc. of the SIGPLAN/SIGSOFT Workshop on Program Analysis For Software Tools and Engineering (PASTE’99), pp. 21–31. Toulouse, France (1999).

  11. 11.

    Choi, J.-D., Gupta, M., Serrano, M.J., Sreedhar, V.C., Midkiff, S.P.: Stack Allocation and Synchronization Optimizations for Java Using Escape Analysis. Technical Report RC22340, IBM (2002).

  12. 12.

    Choi, J.-D., Gupta, M., Serrano, M.J., Sreedhar, V.C., Midkiff, S.P.: Stack Allocation and Synchronization Optimizations for Java Using Escape Analysiss. ACM TOPLAS. 25(6), 876–910 (2003).

    Article  Google Scholar 

  13. 13.

    Cortesi, A., Filé, G., Winsborough, W.: The Quotient of an Abstract Interpretation. Theoret. Comput. Sci., 202(1–2), 163–192 (1998).

    MATH  MathSciNet  Article  Google Scholar 

  14. 14.

    Cousot, P., Cousot, R.: Abstract Interpretation: A Unified Lattice Model for Static Analysis of Programs by Construction or Approximation of Fixpoints. In: Proc. of POPL’77, pp. 238–252 (1977).

  15. 15.

    Cousot, P., Cousot, R.: Abstract Interpretation and Applications to Logic Programs. J Logic Program, 13(2 & 3):103–179 (1992).

    MATH  MathSciNet  Article  Google Scholar 

  16. 16.

    Cousot, P., Cousot, R.: Modular Static Program Analysis. In: Horspool, R.N. (ed.), Proceedings of Compiler Construction, vol. 2304 of Lecture Notes in Computer Science, pp. 159–178. Springer-Verlag, Grenoble, France (2002).

    Google Scholar 

  17. 17.

    Dams, D.R.: Abstract Interpretation and Partition Refinement for Model Checking. PhD thesis, Eindhoven University of Technology, The Netherlands (1996).

  18. 18.

    Dean, J., Grove, D., Chambers, C.: Optimization of Object-Oriented Programs using Static Class Hierarchy Analysis. In: Olthoff, W.G. (ed.), Proc. of ECOOP’95, vol. 952 of LNCS, pp. 77–101. Springer-Verlag, Århus, Denmark, (1995).

    Google Scholar 

  19. 19.

    Deutsch, A.: On the Complexity of Escape Analysis. In: 24th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL’97), pp. 358–371. ACM Press, Paris, France (1997).

    Google Scholar 

  20. 20.

    Dovier, A., Piazza, C., Pontelli, E., Rossi, G.: Sets and Constraint Logic Programming. ACM Trans Program Lang Sys. 22(5), 861–931 (2000).

    Article  Google Scholar 

  21. 21.

    Gay, D., Steensgaard, B.: Fast Escape Analysis and Stack Allocation for Object-Based Programs. In: Watt, D.A. (ed.), Compiler Construction, 9th International Conference (CC’00), vol. 1781 of Lecture Notes in Computer Science, pp. 82–93. Springer-Verlag, Berlin (2000).

    Google Scholar 

  22. 22.

    Giacobazzi, R., Ranzato, F.: Refining and Compressing Abstract Domains. In: Proc. of the 24th International Colloquium on Automata, Languages and Programming (ICALP’97), vol. 1256 of LNCS, pp. 771–781. Springer-Verlag (1997).

  23. 23.

    Giacobazzi, R., Scozzari, F.: A Logical Model for Relational Abstract Domains. ACM Trans Program Lang Sys. 20(5), 1067–1109 (1998).

    Article  Google Scholar 

  24. 24.

    Grove, D., Chambers, C.: A Framework for Call Graph Construction Algorithms. ACM TOPLAS. 23(6), 685–746 (2001).

    Article  Google Scholar 

  25. 25.

    Lhoták, H., Hendren, L.: Scaling Java Points-to Analysis using Spark. In: Hedin, G. (ed.), Proc. of Compiler Construction, vol. 2622 of Lecture Notes in Computer Science, pp. 153–169. Springer-Verlag, Warsaw, Poland (2003).

    Google Scholar 

  26. 26.

    Hill, P.M., Spoto, F.: A Foundation of Escape Analysis. In: Kirchner, H., Ringeissen, C. (ed.), Proc. of AMAST’02, vol. 2422 of LNCS, pp. 380–395. Springer-Verlag, St. Gilles les Bains, La Réunion island, France (2002).

    Google Scholar 

  27. 27.

    Hill, P.M., Spoto, F.: A Refinement of the Escape Property. In: Cortesi, A. (ed.), Proc. of the VMCAI’02 workshop on Verification, Model-Checking and Abstract Interpretation, vol. 2294 of Lecture Notes in Computer Science, pp. 154–166. Springer-Verlag, Venice, Italy (2002).

    Google Scholar 

  28. 28.

    Hill, P.M., Spoto, F.: Logic Programs as Compact Denotations. Comput. Lang. Sys. Struct. 29(3), 45–73 (2003).

    MATH  Article  Google Scholar 

  29. 29.

    Hill, P.M., Spoto, F.: Deriving Escape Analysis by Abstract Interpretation: Proofs of results. The Computing Research Repository (CoRR): arXiv:archive.cs/PL/0607101 (2006).

  30. 30.

    Jacobs, B., Poll, E.: Coalgebras and Monads in the Semantics of Java. Theoret. Comput. Sci. 291(3), 329–349 (2003).

    MATH  MathSciNet  Google Scholar 

  31. 31.

    Jensen, T.: Disjunctive Program Analysis for Algebraic Data Types. ACM Trans. Program. Lang. Syst. 19(5), 752–804 (1997).

    Article  Google Scholar 

  32. 32.

    Jones, N.D., Søndergaard, H.: A Semantics-based Framework for the Abstract Interpretation of Prolog. In: Abramsky, S., Hankin, C. (eds.), Abstract Interpretation of Declarative Languages, pp. 123–142. Ellis Horwood Ltd (1987).

  33. 33.

    Lindholm, T., Yellin, F.: The Java™ Virtual Machine Specification. 2nd edn, Addison-Wesley. (1999).

  34. 34.

    Cousot. P., Cousot, R.: Systematic Design of Program Analysis Frameworks. In: Proc. of the Sixth Annual ACM Symposium on Principles of Programming Languages (POPL’79), pp. 269–282. ACM, San Antonio, Texas (1979).

  35. 35.

    Palsberg, J., Schwartzbach, M.I.: Object-Oriented Type Inference. In: Proc. of OOPSLA’91, volume 26(11) of ACM SIGPLAN Notices, pp. 146–161. ACM Press (1991).

  36. 36.

    Park, Y.G., Goldberg, B.: Escape Analysis on Lists. In: ACM SIGPLAN’92 Conference on Programming Language Design and Implementation (PLDI’92), vol. 27(7) of SIGPLAN Notices, pp. 116–127. San Francisco, California, USA (1992).

  37. 37.

    Rountev, A., Milanova, A., Ryder, B.G.: Points-to Analysis for Java Using Annotated Constraints. In: Proc. of ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages and Applications (OOPSLA’01), volume 36(11), of ACM SIGPLAN, pp. 43–55. Tampa, Florida, USA (2001).

  38. 38.

    Ruf, E.: Effective Synchronization Removal for Java. In: ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI’00), vol. 35(5) of SIGPLAN Notices, pp. 208–218. Vancouver, British Columbia, Canada (2000).

  39. 39.

    Ruggieri, C., Murtagh, T.P.: Lifetime Analysis of Dynamically Allocated Objects. In: 15th ACM Symposium on Principles of Programming Languages (POPL’88), pp. 285–293. San Diego, California, USA (1988).

  40. 40.

    Salcianu, A.: Pointer Analysis and Its Application to Java Programs. PhD thesis, MIT (2001).

  41. 41.

    Salcianu, A., Rinard, M.: Pointer and Escape Analysis for Multithreaded Programs. In: Proc. of ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming (PPoPP’01), volume 36(7) of SIGPLAN Notices, pp. 12–23, Snowbird, Utah, USA (2001)

  42. 42.

    Scozzari, F.: Logical Optimality of Groundness Analysis. Theoret. Compu. Sci., 277(1–2), 149–184 (2002).

    MATH  MathSciNet  Article  Google Scholar 

  43. 43.

    Søndergaard, H.: An Application of Abstract Interpretation of Logic Programs: Occur Check Reduction. In: Robinet, B., Wilhelm, R. (eds.), Proc. of the European Symposium on Programming (ESOP), vol. 213 of Lecture Notes in Computer Science, pp. 327–338. Springer, Saarbrücken, Federal Republic of Germany (1986).

    Google Scholar 

  44. 44.

    Spoto, F.: The Julia Generic Static Analyser. Available at the address http://www.sci.univr.it/~spoto/julia (2004).

  45. 45.

    Spoto, F., Jensen, T.: Class Analyses as Abstract Interpretations of Trace Semantics. ACM Trans. Program. Lang. Sys. (TOPLAS), 25(5), 578–630 (2003).

    Article  Google Scholar 

  46. 46.

    Streckenbach, M., Snelting, G.: Points-to for Java: A General Framework and an Empirical Comparison. Technical report, Universität Passau, Germany (2000).

  47. 47.

    Tarski, A.: A Lattice-theoretical Fixpoint Theorem and its Applications. Pacific J. Math. 5, 285–309 (1955).

    MATH  MathSciNet  Google Scholar 

  48. 48.

    Tip, F., Palsberg, J.: Scalable Propagation-Based Call Graph Construction Algorithms. In: Proc. of OOPSLA’00, vol. 35(10) of SIGPLAN Notices, pp. 281–293. ACM, Minneapolis, Minnesota, USA (2000).

    Google Scholar 

  49. 49.

    Vivien, F., Rinard, M.: Incrementalized Pointer and Escape Analysis. In: Proc. of ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI’01), volume 36(5), SIGPLAN Notices, pp. 35–46. Snowbird, Utah, USA (2001).

  50. 50.

    Whaley, J., Lam, M.S.: Cloning-Based Context-Sensitive Pointer Alias Analysis Using Binary Decision Diagrams. In: Pugh, W., Chambers, C. (eds.), Proc. of ACM SIGPLAN 2004 Conference on Programming Language Design and Implementation (PLDI’04), pp. 131–144. ACM, Washington, DC, USA (2004).

    Google Scholar 

  51. 51.

    Whaley, J., Rinard, M.C.: Compositional Pointer and Escape Analysis for Java Programs. In: 1999 ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages and Applications (OOPSLA’99), volume 34(1), SIGPLAN Notices, pp. 187–206. Denver, Colorado, USA (1999).

  52. 52.

    Winskel, G.: The Formal Semantics of Programming Languages. The MIT Press (1993).

Download references

Author information

Affiliations

Authors

Corresponding author

Correspondence to Patricia M. Hill.

Rights and permissions

Reprints and Permissions

About this article

Cite this article

Hill, P.M., Spoto, F. Deriving escape analysis by abstract interpretation. Higher-Order Symb Comput 19, 415–463 (2006). https://doi.org/10.1007/s10990-006-0481-5

Download citation

Keywords

  • Abstract interpretation
  • Denotational semantics
  • Garbage collection