ABSTRACT
Reference immutability ensures that a reference is not used to modify the referenced object, and enables the safe sharing of object structures. A pure method does not cause side-effects on the objects that existed in the pre-state of the method execution. Checking and inference of reference immutability and method purity enables a variety of program analyses and optimizations. We present ReIm, a type system for reference immutability, and ReImInfer, a corresponding type inference analysis. The type system is concise and context-sensitive. The type inference analysis is precise and scalable, and requires no manual annotations. In addition, we present a novel application of the reference immutability type system: method purity inference.
To support our theoretical results, we implemented the type system and the type inference analysis for Java. We include a type checker to verify the correctness of the inference result. Empirical results on Java applications and libraries of up to 348kLOC show that our approach achieves both scalability and precision.
- S. Artzi, A. KieÙ zun, D. Glasser, and M. D. Ernst. Combined static and dynamic mutability analysis. In ASE, pages 104--113, 2007. Google ScholarDigital Library
- S. Artzi, A. KieÙ zun, J. Quinonez, and M. D. Ernst. Parameter reference immutability: formal definition, inference tool, and comparison. Automated Software Engineering, 16(1):145--192, Dec. 2009. Google ScholarDigital Library
- M. Barnett, D. A. Naumann, W. Schulte, and Q. Sun. 99.44% pure: Useful abstractions in specifications. In FTfJP, pages 11--19, 2004.Google Scholar
- B. Chin, S. Markstrum, T. Millstein, and J. Palsberg. Inference of user-defined type qualifiers and qualifier rules. In ESOP, pages 264--278, 2006. Google ScholarDigital Library
- D. Clarke, J. M. Potter, and J. Noble. Ownership types for flexible alias protection. In OOPSLA, pages 48--64, 1998. Google ScholarDigital Library
- L. R. Clausen. A Java bytecode optimizer using side-effect analysis. Concurrency: Practice and Experience, 9:1031--1045, 1997.Google ScholarCross Ref
- D. Cunningham, W. Dietl, S. Drossopoulou, A. Francalanza, P. Müller, and A. J. Summers. Universe Types for topology and encapsulation. In FMCO, 2008. Google ScholarDigital Library
- V. Dallmeier, C. Lindig, and A. Zeller. Dynamic purity analysis for java programs. http://www.st.cs.uni-saarland.de/models/jpure/, 2007.Google Scholar
- W. Dietl and P. Müller. Universes: Lightweight ownership for JML. Journal of Object Technology, 4:5--32, 2005.Google ScholarCross Ref
- W. Dietl, S. Drossopoulou, and P. Müller. Generic Universe Types. In ECOOP, pages 28--53, 2007. Google ScholarDigital Library
- W. Dietl, S. Dietzel, M. D. Ernst, K. Muslu, and T. W. Schiller. Building and using pluggable type-checkers. In ICSE, pages 681--690, 2011. Google ScholarDigital Library
- W. Dietl, M. D. Ernst, and P. Muller. Tunable static inference for Generic Universe Types. In ECOOP, pages 333--357, 2011. Google ScholarDigital Library
- M. D. Ernst. Type Annotations specification (JSR 308). http://types.cs.washington.edu/jsr308/, July 3, 2012.Google Scholar
- R. Fuhrer, F. Tip, A. KieÙzun, J. Dolby, and M. Keller. Efficiently refactoring Java applications to use generic libraries. In ECOOP, pages 71--96, July 2005. Google ScholarDigital Library
- D. Greenfieldboyce and J. S. J. Foster. Type qualifier inference for Java. In OOPSLA, pages 321--336, 2007. Google ScholarDigital Library
- C. Haack, E. Poll, J. Schäfer, and A. Schubert. Immutable objects for a Java-like language. In ESOP, pages 347--362, Mar. 2007. Google ScholarDigital Library
- A. Heydon, R. Levin, and Y. Yu. Caching function calls using precise dependencies. In PLDI, pages 311--320, 2000. Google ScholarDigital Library
- W. Huang, W. Dietl, A. Milanova, and M. D. Ernst. Inference and checking of object ownership. In ECOOP, pages 181--206, 2012. Google ScholarDigital Library
- A. Le, O. Lhotak, and L. Hendren. Using inter-procedural side-effect information in JIT optimizations. In CC, pages 287--304, 2005. Google ScholarDigital Library
- Y. Liu and A. Milanova. Ownership and immutability inference for UML-based object access control. In ICSE, pages 323--332, 2007. Google ScholarDigital Library
- A. Milanova and W. Huang. Static object race detection. In APLAS, pages 255--271, 2011. Google ScholarDigital Library
- A. Milanova, A. Rountev, and B. G. Ryder. Parameterized object sensitivity for points-to analysis for Java. ACM Transactions on Software Engineering and Methodology, 14(1):1--41, Jan. 2005. Google ScholarDigital Library
- M. M. Papi, M. Ali, T. L. Correa, Jr., J. H. Perkins, and M. D. Ernst. Practical pluggable types for Java. In ISSTA, pages 201--212, 2008. Google ScholarDigital Library
- D. Pearce. JPure: A modular purity system for Java. In CC, pages 104--123, 2011. Google ScholarDigital Library
- S. Porat, M. Biberstein, L. Koved, and B. Mendelson. Automatic detection of immutable fields in Java. In CASCON, pages 10--24, 2000. Google ScholarDigital Library
- J. Quinonez, M. S. Tschantz, and M. D. Ernst. Inference of reference immutability. In ECOOP, pages 616--641, 2008. Google ScholarDigital Library
- T. Reps. Undecidability of context-sensitive data-independence analysis. ACM Transactions on Programming Languages and Systems, 22:162--186, 2000. Google ScholarDigital Library
- A. Rountev. Precise identification of side-effect-free methods in Java. In ICSM, pages 82--91, 2004. Google ScholarDigital Library
- A. Sampson, W. Dietl, E. Fortuna, D. Gnanapragasam, L. Ceze, and D. Grossman. EnerJ: Approximate data types for safe and general low-power computation. In PLDI, pages 164--174, 2011. Google ScholarDigital Library
- A. Salcianu and M. Rinard. Purity and side effect analysis for Java programs. In VMCAI, pages 199--215, 2005. Google ScholarDigital Library
- F. Tip, R. M. Fuhrer, A. KieÙzun, M. D. Ernst, I. Balaban, and B. D. Sutter. Refactoring using type constraints. ACM Transactions on Programming Languages and Systems, 33(3): 9:1--9:47, May 2011. Google ScholarDigital Library
- O. Tkachuk and M. B. Dwyer. Adapting side effects analysis for modular program model checking. In ESEC/FSE, pages 188--197, 2003. Google ScholarDigital Library
- M. S. Tschantz and M. D. Ernst. Javari: Adding reference immutability to Java. In OOPSLA, pages 211--230, 2005. Google ScholarDigital Library
- R. Vallee-Rai, P. Co, E. Gagnon, L. Hendren, P. Lam, and V. Sundaresan. Soot - a Java bytecode optimization framework. In CASCON, pages 13--, 1999. Google ScholarDigital Library
- M. Vaziri, F. Tip, J. Dolby, C. Hammer, and J. Vitek. A type system for data-centric synchronization. In ECOOP, pages 304--328, 2010. Google ScholarDigital Library
- H. Xu, C. J. F. Pickett, and C. Verbrugge. Dynamic purity analysis for Java programs. In PASTE, pages 75--82, 2007. Google ScholarDigital Library
- J. Zhao, I. Rogers, and C. Kirkham. Pure method analysis within Jikes RVM. In ICOOOLPS, 2008.Google Scholar
- Y. Zibin, A. Potanin, M. Ali, S. Artzi, A. Kiezun, and M. D. Ernst. Object and reference immutability using Java generics. In ESEC/FSE, pages 75-84, Sept. 2007. Google ScholarDigital Library
- Y. Zibin, A. Potanin, P. Li, M. Ali, and M. D. Ernst. Ownership and immutability in generic Java. In OOPSLA, pages 598--617, Oct. 2010. Google ScholarDigital Library
Index Terms
- Reim & ReImInfer: checking and inference of reference immutability and method purity
Recommendations
ReImInfer: method purity inference for Java
FSE '12: Proceedings of the ACM SIGSOFT 20th International Symposium on the Foundations of Software EngineeringMethod purity inference, also known as side-effect analysis, is an important problem. It has many applications including compiler optimization, model checking, memoization of function calls, atomicity, etc. Surprisingly, despite the long history of this ...
Reim & ReImInfer: checking and inference of reference immutability and method purity
OOPSLA '12Reference immutability ensures that a reference is not used to modify the referenced object, and enables the safe sharing of object structures. A pure method does not cause side-effects on the objects that existed in the pre-state of the method ...
Javari: adding reference immutability to Java
Proceedings of the 20th annual ACM SIGPLAN conference on Object oriented programming systems languages and applicationsThis paper describes a type system that is capable of expressing and enforcing immutability constraints. The specific constraint expressed is that the abstract state of the object to which an immutable reference refers cannot be modified using that ...
Comments