skip to main content
10.1145/2384616.2384680acmconferencesArticle/Chapter ViewAbstractPublication PagessplashConference Proceedingsconference-collections
research-article

Reim & ReImInfer: checking and inference of reference immutability and method purity

Published:19 October 2012Publication History

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.

References

  1. S. Artzi, A. KieÙ zun, D. Glasser, and M. D. Ernst. Combined static and dynamic mutability analysis. In ASE, pages 104--113, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  3. M. Barnett, D. A. Naumann, W. Schulte, and Q. Sun. 99.44% pure: Useful abstractions in specifications. In FTfJP, pages 11--19, 2004.Google ScholarGoogle Scholar
  4. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  5. D. Clarke, J. M. Potter, and J. Noble. Ownership types for flexible alias protection. In OOPSLA, pages 48--64, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. L. R. Clausen. A Java bytecode optimizer using side-effect analysis. Concurrency: Practice and Experience, 9:1031--1045, 1997.Google ScholarGoogle ScholarCross RefCross Ref
  7. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  8. V. Dallmeier, C. Lindig, and A. Zeller. Dynamic purity analysis for java programs. http://www.st.cs.uni-saarland.de/models/jpure/, 2007.Google ScholarGoogle Scholar
  9. W. Dietl and P. Müller. Universes: Lightweight ownership for JML. Journal of Object Technology, 4:5--32, 2005.Google ScholarGoogle ScholarCross RefCross Ref
  10. W. Dietl, S. Drossopoulou, and P. Müller. Generic Universe Types. In ECOOP, pages 28--53, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  12. W. Dietl, M. D. Ernst, and P. Muller. Tunable static inference for Generic Universe Types. In ECOOP, pages 333--357, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. M. D. Ernst. Type Annotations specification (JSR 308). http://types.cs.washington.edu/jsr308/, July 3, 2012.Google ScholarGoogle Scholar
  14. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  15. D. Greenfieldboyce and J. S. J. Foster. Type qualifier inference for Java. In OOPSLA, pages 321--336, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  17. A. Heydon, R. Levin, and Y. Yu. Caching function calls using precise dependencies. In PLDI, pages 311--320, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. W. Huang, W. Dietl, A. Milanova, and M. D. Ernst. Inference and checking of object ownership. In ECOOP, pages 181--206, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. A. Le, O. Lhotak, and L. Hendren. Using inter-procedural side-effect information in JIT optimizations. In CC, pages 287--304, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Y. Liu and A. Milanova. Ownership and immutability inference for UML-based object access control. In ICSE, pages 323--332, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. A. Milanova and W. Huang. Static object race detection. In APLAS, pages 255--271, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  23. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  24. D. Pearce. JPure: A modular purity system for Java. In CC, pages 104--123, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. S. Porat, M. Biberstein, L. Koved, and B. Mendelson. Automatic detection of immutable fields in Java. In CASCON, pages 10--24, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. J. Quinonez, M. S. Tschantz, and M. D. Ernst. Inference of reference immutability. In ECOOP, pages 616--641, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. T. Reps. Undecidability of context-sensitive data-independence analysis. ACM Transactions on Programming Languages and Systems, 22:162--186, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. A. Rountev. Precise identification of side-effect-free methods in Java. In ICSM, pages 82--91, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  30. A. Salcianu and M. Rinard. Purity and side effect analysis for Java programs. In VMCAI, pages 199--215, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  32. O. Tkachuk and M. B. Dwyer. Adapting side effects analysis for modular program model checking. In ESEC/FSE, pages 188--197, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. M. S. Tschantz and M. D. Ernst. Javari: Adding reference immutability to Java. In OOPSLA, pages 211--230, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  35. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  36. H. Xu, C. J. F. Pickett, and C. Verbrugge. Dynamic purity analysis for Java programs. In PASTE, pages 75--82, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. J. Zhao, I. Rogers, and C. Kirkham. Pure method analysis within Jikes RVM. In ICOOOLPS, 2008.Google ScholarGoogle Scholar
  38. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  39. 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 ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Reim & ReImInfer: checking and inference of reference immutability and method purity

    Recommendations

    Comments

    Login options

    Check if you have access through your login credentials or your institution to get full access on this article.

    Sign in
    • Published in

      cover image ACM Conferences
      OOPSLA '12: Proceedings of the ACM international conference on Object oriented programming systems languages and applications
      October 2012
      1052 pages
      ISBN:9781450315616
      DOI:10.1145/2384616
      • cover image ACM SIGPLAN Notices
        ACM SIGPLAN Notices  Volume 47, Issue 10
        OOPSLA '12
        October 2012
        1011 pages
        ISSN:0362-1340
        EISSN:1558-1160
        DOI:10.1145/2398857
        Issue’s Table of Contents

      Copyright © 2012 ACM

      Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 19 October 2012

      Permissions

      Request permissions about this article.

      Request Permissions

      Check for updates

      Qualifiers

      • research-article

      Acceptance Rates

      Overall Acceptance Rate268of1,244submissions,22%

      Upcoming Conference

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader