Parameter reference immutability: formal definition, inference tool, and comparison

Knowing which method parameters may be mutated during a method’s execution is useful for many software engineering tasks. A parameter reference is immutable if it cannot be used to modify the state of its referent object during the method’s execution. We formally define this notion, in a core object-oriented language. Having the formal definition enables determining correctness and accuracy of tools approximating this definition and unbiased comparison of analyses and tools that approximate similar definitions.We present Pidasa, a tool for classifying parameter reference immutability. Pidasa combines several lightweight, scalable analyses in stages, with each stage refining the overall result. The resulting analysis is scalable and combines the strengths of its component analyses. As one of the component analyses, we present a novel dynamic mutability analysis and show how its results can be improved by random input generation. Experimental results on programs of up to 185 kLOC show that, compared to previous approaches, Pidasa increases both run-time performance and overall accuracy of immutability inference.

[1]  Haiying Xu,et al.  Dynamic purity analysis for java programs , 2007, PASTE '07.

[2]  David W. Binkley,et al.  Program slicing , 2008, 2008 Frontiers of Software Maintenance.

[3]  Vivek Sarkar,et al.  Immutability specification and its applications , 2002, JGI '02.

[4]  John Hogg,et al.  Islands: aliasing protection in object-oriented languages , 1991, OOPSLA '91.

[5]  Michael D. Ernst,et al.  Finding the needles in the haystack: Generating legal test inputs for object-oriented programs , 2006 .

[6]  Michael Hind,et al.  Pointer analysis: haven't we solved this problem yet? , 2001, PASTE '01.

[7]  Benjamin C. Pierce,et al.  Types and programming languages: the next generation , 2003, 18th Annual IEEE Symposium of Logic in Computer Science, 2003. Proceedings..

[8]  Philip J. Guo A Scalable Mixed-Level Approach to Dynamic Analysis of C and C++ Programs , 2006 .

[9]  Jong-Deok Choi,et al.  Hybrid dynamic data race detection , 2003, PPoPP '03.

[10]  Frank Tip,et al.  Declarative Object Identity Using Relation Types , 2007, ECOOP.

[11]  Michael D. Ernst,et al.  Inference of Reference Immutability , 2008, ECOOP.

[12]  Martin C. Rinard,et al.  Purity and Side Effect Analysis for Java Programs , 2005, VMCAI.

[13]  Michael D. Ernst,et al.  A practical type system and language for reference immutability , 2004, OOPSLA '04.

[14]  Peter Müller,et al.  Universes: Lightweight Ownership for JML , 2005, J. Object Technol..

[15]  William G. Griswold,et al.  Dynamically discovering likely program invariants to support program evolution , 1999, Proceedings of the 1999 International Conference on Software Engineering (IEEE Cat. No.99CB37002).

[16]  Mark Harman,et al.  An Empirical Investigation of the Influence of a Type of Side Effects on Program Comprehension , 2003, IEEE Trans. Software Eng..

[17]  Bilha Mendelson,et al.  Automatic detection of immutable fields in Java , 2000, CASCON.

[18]  Michael D. Ernst,et al.  Javari: adding reference immutability to Java , 2005, OOPSLA '05.

[19]  Philip Wadler,et al.  Featherweight Java: a minimal core calculus for Java and GJ , 1999, OOPSLA '99.

[20]  Michael Burrows,et al.  Eraser: a dynamic data race detector for multi-threaded programs , 1997, TOCS.

[21]  Jan Vitek,et al.  Flexible Alias Protection , 1998, ECOOP.

[22]  Chrislain Razafimahefa A Study Of Side-Effect Analyses For Java , 1999 .

[23]  Tobias Wrigstad,et al.  A mode system for read-only references in Java , 2001 .

[24]  Amer Diwan,et al.  Simple and effective analysis of statically-typed object-oriented programs , 1996, OOPSLA '96.

[25]  Michael Burrows,et al.  Eraser: a dynamic data race detector for multithreaded programs , 1997, TOCS.

[26]  Andreas Zeller,et al.  Mining object behavior with ADABU , 2006, WODA '06.

[27]  LiblitBen,et al.  Dynamic heap type inference for program understanding and debugging , 2007 .

[28]  Matthew B. Dwyer,et al.  Adapting side effects analysis for modular program model checking , 2003, ESEC/FSE-11.

[29]  Néstor Cataño,et al.  CHASE: A Static Checker for JML's Assignable Clause , 2002, VMCAI.

[30]  Joseph Gil,et al.  Sealing, Encapsulation, and Mutability , 2001, ECOOP.

[31]  Michael D. Ernst,et al.  Object and reference immutability using Java generics , 2007, ESEC-FSE '07.

[32]  Ondrej Lhoták,et al.  Using Inter-Procedural Side-Effect Information in JIT Optimizations , 2005, CC.

[33]  John Tang Boyland,et al.  Capabilities for Sharing: A Generalisation of Uniqueness and Read-Only , 2001, ECOOP.

[34]  Barbara G. Ryder,et al.  Interprocedural modification side effect analysis with pointer aliasing , 1993, PLDI '93.

[35]  Barbara G. Ryder,et al.  A safe approximate algorithm for interprocedural aliasing , 1992, PLDI '92.

[36]  Barbara G. Ryder,et al.  Points-to and Side-Effect Analyses for Programs Built with Precompiled Libraries , 2001, CC.

[37]  David Glasser,et al.  Combined static and dynamic mutability analysis , 2007, ASE '07.

[38]  Martin C. Rinard,et al.  Role-based exploration of object-oriented programs , 2002, ICSE '02.

[39]  Ben Liblit,et al.  Dynamic heap type inference for program understanding and debugging , 2007, POPL '07.

[40]  Jeffrey S. Foster,et al.  Type qualifier inference for java , 2007, OOPSLA.

[41]  David Grove,et al.  Optimization of Object-Oriented Programs Using Static Class Hierarchy Analysis , 1995, ECOOP.

[42]  John Banning,et al.  : An Efficient , 2022 .

[43]  Lars Ræder Clausen A Java Bytecode Optimizer Using Side-Effect Analysis , 1997, Concurr. Pract. Exp..

[44]  Jamie Quinonez Javarifier : inference of reference immutability in Java , 2008 .

[45]  Alexandru Salcianu,et al.  Pointer analysis for Java programs: novel techniques and applications , 2006 .

[46]  Acm Sigsoft,et al.  Proceedings of the 2001 ACM SIGPLAN-SIGSOFT Workshop on Program Analysis for Software Tools and Engineering : PASTE '01, Snowbird, Utah, USA, June 18-19, 2001 , 2001 .

[47]  Alexander Aiken,et al.  A theory of type qualifiers , 1999, PLDI '99.

[48]  Tao Xie,et al.  Augmenting Automatically Generated Unit-Test Suites with Regression Oracle Checking , 2006, ECOOP.

[49]  Barbara G. Ryder,et al.  A schema for interprocedural modification side-effect analysis with pointer aliasing , 2001, TOPL.

[50]  Michael D. Ernst,et al.  Tools for enforcing and inferring reference immutability in Java , 2007, OOPSLA '07.

[51]  Michael D. Ernst,et al.  Practical pluggable types for java , 2008, ISSTA '08.

[52]  Leonardo Mariani,et al.  Behavior capture and test: automated analysis of component integration , 2005, 10th IEEE International Conference on Engineering of Complex Computer Systems (ICECCS'05).

[53]  Barbara G. Ryder,et al.  Parameterized object sensitivity for points-to and side-effect analyses for Java , 2002, ISSTA '02.

[54]  Jong-Deok Choi,et al.  Efficient flow-sensitive interprocedural computation of pointer-induced aliases and side effects , 1993, POPL '93.

[55]  Jens Palsberg,et al.  Scalable propagation-based call graph construction algorithms , 2000, OOPSLA '00.

[56]  Barbara G. Ryder,et al.  Points-to analysis for Java based on annotated constraints , 2000 .

[57]  Michael D. Ernst,et al.  Feedback-Directed Random Test Generation , 2007, 29th International Conference on Software Engineering (ICSE'07).

[58]  Atanas Rountev,et al.  Precise identification of side-effect-free methods in Java , 2004, 20th IEEE International Conference on Software Maintenance, 2004. Proceedings..

[59]  Bjarne Stroustrup,et al.  The C++ Programming Language: Special Edition , 2000 .

[60]  Michael D. Ernst,et al.  An overview of JML tools and applications , 2003, Electron. Notes Theor. Comput. Sci..

[61]  Bjarne Stroustrup,et al.  C++ Programming Language , 1986, IEEE Softw..

[62]  Martin Fowler,et al.  Refactoring - Improving the Design of Existing Code , 1999, Addison Wesley object technology series.

[63]  Ken Kennedy,et al.  Interprocedural side-effect analysis in linear time , 1988, PLDI '88.

[64]  John Tang Boyland,et al.  Why we should not add readonly to Java (yet) , 2006, J. Object Technol..

[65]  David F. Bacon,et al.  Fast static analysis of C++ virtual function calls , 1996, OOPSLA '96.

[66]  Dirk Theisen,et al.  JAC—Access right based encapsulation for Java , 2001, Softw. Pract. Exp..

[67]  Erik Ruf,et al.  Context-insensitive alias analysis reconsidered , 1995, PLDI '95.

[68]  Barbara G. Ryder,et al.  Points-to analysis for Java using annotated constraints , 2001, OOPSLA '01.