Removing unnecessary synchronization in Java

Java programs perform many synchronization operations on data structures. Some of these synchronization are unnecessary; in particular, if an object is reachable only by a single thread, concurrent access is impossible and no synchronization is needed. We describe an interprocedural, flow- and context-insensitive dataflow analysis that finds such situations. A global optimizing transformation then eliminates synchronizations on these objects. For every program in our suite of ten Java benchmarks consisting of SPECjvm98 and others, our system optimizes over 90% of the alias sets containing at least one synchronized object. As a result, the dynamic frequency of synchronizations is reduced by up to 99%. For two benchmarks that perform synchronizations very frequently, this optimization leads to speedups of 36% and 20%.

[1]  Monica S. Lam,et al.  Efficient context-sensitive pointer analysis for C programs , 1995, PLDI '95.

[2]  Jong-Deok Choi,et al.  Escape analysis for Java , 1999, OOPSLA '99.

[3]  Andreas Krall,et al.  Efficient JavaVM just-in-time compilation , 1998, Proceedings. 1998 International Conference on Parallel Architectures and Compilation Techniques (Cat. No.98EX192).

[4]  Y. S. Ramakrishna,et al.  An efficient meta-lock for implementing ubiquitous synchronization , 1999, OOPSLA '99.

[5]  Martin C. Rinard,et al.  Lock Coarsening: Eliminating Lock Overhead in Automatically Parallelized Object-Based Programs , 1998, J. Parallel Distributed Comput..

[6]  Frank Yellin,et al.  The Java Virtual Machine Specification , 1996 .

[7]  Martin C. Rinard,et al.  Pointer analysis for multithreaded programs , 1999, PLDI '99.

[8]  Guy L. Steele,et al.  The Java Language Specification , 1996 .

[9]  Reinhard Wilhelm,et al.  Solving shape-analysis problems in languages with destructive updating , 1998, TOPL.

[10]  Charles Consel,et al.  Harissa: A Flexible and Efficient Java Environment Mixing Bytecode and Compiled Code , 1997, COOTS.

[11]  David F. Bacon,et al.  Fast and effective optimization of statically typed object-oriented languages , 1997 .

[12]  Andreas Krall,et al.  Monitors and Exceptions: How to Implement Java Efficiently , 1998, Concurr. Pract. Exp..

[13]  Urs Hölzle,et al.  j2s: A SUIF Java Compiler , 1997 .

[14]  Laurie J. Hendren,et al.  Is it a tree, a DAG, or a cyclic graph? A shape analysis for heap-directed pointers in C , 1996, POPL '96.

[15]  Martin C. Rinard,et al.  Lock Coarsening: Eliminating Lock Overhead in Automatically Parallelized Object-Based Programs , 1996, LCPC.

[16]  Erik Ruf,et al.  Marmot: an optimizing compiler for Java , 2000, Softw. Pract. Exp..

[17]  James C. Corbett,et al.  Using shape analysis to reduce finite-state models of concurrent Java programs , 2000, TSEM.

[18]  Bjarne Steensgaard Stack Allocating Objects in Java , 1998 .

[19]  Emin Gün Sirer,et al.  Static Analyses for Eliminating Unnecessary Synchronization from Java Programs , 1999, SAS.

[20]  Julian Dolby Automatic inline allocation of objects , 1997, PLDI '97.

[21]  Thomas P. Murtagh,et al.  Lifetime analysis of dynamically allocated objects , 1988, POPL '88.

[22]  Marc Najork,et al.  Performance limitations of the Java core libraries , 1999, JAVA '99.

[23]  Bruno Blanchet,et al.  Escape analysis: correctness proof, implementation and experimental results , 1998, POPL '98.

[24]  Andrew A. Chien,et al.  An evaluation of automatic object inline allocation techniques , 1998, OOPSLA '98.

[25]  Charles E. McDowell,et al.  Reducing garbage in Java , 1998, SIGP.