Abstract
Concurrency is an integral feature of Java. While there has been recent research [CGS+99,BH99,WR99,Bla99] on devising analyses to eliminate the overhead imposed by synchronization, these analyses do not explicitly track multiple threads of control, nor do they appear particularly well-suited to facilitate other concurrency-related optimizations that may be applicable in a parallel or distributed environment.
In this paper, we develop a novel program analysis for Java, which explicitly incorporates an abstract (semantic) notion of threads. Our analysis framework is distinguished from related efforts in three important respects:
-
1
It employs a whole-program flow analysis adapted from a simple sequential analysis framework that formally defines a notion of an abstract thread of control. Our initial approximation defines for each thread the set of objects potentially locked or accessed by that thread.
-
2
The approximation imposes no restriction on the lifetime of objects involved in a synchronization event. Thus, objects may freely escape from the context in which they are created without necessarily being regarded as shared by multiple threads.
-
3
To provide added precision, the analysis is subsequently refined to use a per program-point abstract heap. The use of such a heap allows thread-specific flow-sensitive optimizations to be selectively applied in different program contexts, but requires a more sophisticated notion of reachability. One immediate consequence of this framework is its ability to support strong-updates [CWZ90] of global shared data.
Our analysis has been implemented as part of a native-code optimizing compiler for Java currently under development. Benchmark results indicate the analyses have relatively small computation cost, but can lead to significant improvements in the quality of generated code.
Chapter PDF
References
Aldrich, J., Chambers, C., Sirer, E., Eggers, S.: Static analysis for eliminating unnecessary synchronization in Java programs. In: International Static Analysis Symposium, September 1999, pp. 19–38 (1999)
Agesen, O.: The cartesian product algorithm: simple and precise type inference of parametric polymorphism. In: Olthoff, W. (ed.) ECOOP 1995. LNCS, vol. 952, pp. 2–26. Springer, Heidelberg (1995)
Bogda, J., Holzle, U.: Removing unnecessary synchronization in Java. In: Conference on Object-Oriented Programming Systems, Languages, and Applications, November 1999, pp. 35–47 (1999)
Bacon, D., Konru, R., Murthy, C., Serrano, M.: Thin locks: featherweight synchronization for Java. In: ACM Conference on Programming Language Design and Implementation, June 1998, pp. 258–268 (1998)
Blanchet, B.: Escape analysis for object-oriented languages: application to Java. In: Conference on Object-Oriented Programming Systems, Languages, and Applications, November 1999, pp. 20–35 (1999)
Choi, J.-D., Gupta, M., Serrano, M., Sreedhar, V., Midkiff, S.: Escape analysis for Java. In: Conference on Object- Oriented Programming Systems, Languages, and Applications, November 1999, pp. 1–19 (1999)
Chow, J.-H., Harrison III, W.L.: Compile time analysis of parallel programs that share memory. In: 19th ACM Symposium on Principles of Programming Languages (January 1992)
Chase, D.R., Wegman, M., Zadeck, F.K.: Analysis of pointers and structures. In: ACM Conference on Programming Language Design and Implementation, June 1990, pp. 296–310 (1990)
Deutsch, A.: On determining lifetime and aliasing of dynamically allocated data in higher-order functional specifications. In: 17th ACM Symposium on Principles of Programming Languages, January 1990, pp. 157–168 (1990)
DeFouw, G., Grove, D., Chambers, C.: Fast interprocedural class analysis. In: 25th ACM Symposium on Principles of Programming Languages, January 1998, pp. 222–236 (1998)
Heintze, N.: Set-based analysis of ML programs. In: ACM International Conference on Lisp and Functional Programming, June 1994, pp. 306–317 (1994)
ACM Workshop on Java for High-Performance Network Computing (1998)
Java Grande 99. ACM (June 1999)
Jones, N., Muchnick, S.: Flow analysis and optimization of Lisplike structures. In: 6th ACM Symposium on Principles of Programming Languages, January 1979, pp. 244–256 (1979)
Jagannathan, S., Weeks, S.T.: Analyzing stores and references in a parallel symbolic language. In: ACM International Conference on Lisp and Functional Programming, pp. 294–305 (1994)
Jagannathan, S., Weeks, S.T.: A unified treatment of flow analysis in higher-order languages. In: 22nd ACM Symposium on Principles of Programming Languages, January 1995, pp. 393–407 (1995)
Mercouroff, N.: An algorithm for analyzing communicating processes. In: Mathematical Foundations of Programming Semantics, Springer, Heidelberg (1991)
Milner, R., Tofte, M., Harper, R., Macqueen, D.B.: The Definition of Standard ML (Revised). MIT Press, Cambridge (1997)
Plevyak, J., Chien, A.A.: Precise concrete type inference for object-oriented languages. In: Conference on Object-Oriented Programming Systems, Language, and Applications, October 1994, pp. 324–340 (1994)
Palsberg, J., Schwartzbach, M.I.: Object-oriented type inference. In: Conference on Object-Oriented Programming Systems, Languages, and Applications, October 1991, pp. 146–161 (1991)
Ruggieri, C., Murtagh, T.P.: Lifetime analysis of dynamically allocated objects. In: ACM Symposium on Principles of Programming Languages, January 1988, pp. 285–293 (1988)
Serrano, M., Feeley, M.: Storage use analysis and its applications. In: International Conference on Functional Programming (May 1996)
Shivers, O.: Control-Flow Analysis of Higher-Order Languages or Taming Lambda. PhD thesis, School of Computer Science, Carnegie-Mellon University (1991)
Sagiv, M., Reps, T., Wilhelm, R.: Solving shape analysis problems in languages with destructive updating. ACM Transactions on Programming Languages and Systems 20(1), 1–50 (1996)
Whaley, J., Rinard, M.: Compositional pointer and escape analysis for Java programs. In: Conference on Object-Oriented Programming Systems, Languages, and Applications, November 1999, pp. 187–207 (1999)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2000 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Ungureanu, C., Jagannathan, S. (2000). Concurrency Analysis for Java. In: Palsberg, J. (eds) Static Analysis. SAS 2000. Lecture Notes in Computer Science, vol 1824. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-45099-3_22
Download citation
DOI: https://doi.org/10.1007/978-3-540-45099-3_22
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-67668-3
Online ISBN: 978-3-540-45099-3
eBook Packages: Springer Book Archive