ACM Home Page
Please provide us with feedback. Feedback
Automatic inference of stationary fields: a generalization of java's final fields
Full text PdfPdf (239 KB)
Source
Annual Symposium on Principles of Programming Languages archive
Proceedings of the 35th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languages table of contents
San Francisco, California, USA
SESSION: Session 6 table of contents
Pages 183-195  
Year of Publication: 2008
ISBN:978-1-59593-689-9
Also published in ...
Authors
Christopher Unkel  Stanford University, Stanford, CA
Monica S. Lam  Stanford University, Stanford, CA
Sponsors
ACM: Association for Computing Machinery
SIGACT: ACM Special Interest Group on Algorithms and Computation Theory
SIGPLAN: ACM Special Interest Group on Programming Languages
Publisher
ACM  New York, NY, USA
Bibliometrics
Downloads (6 Weeks): 7,   Downloads (12 Months): 86,   Citation Count: 4
Additional Information:

abstract   references   cited by   index terms   collaborative colleagues  

Tools and Actions: Request Permissions Request Permissions    Review this Article  
DOI Bookmark: Use this link to bookmark this Article: http://doi.acm.org/10.1145/1328438.1328463
What is a DOI?

ABSTRACT

Java programmers can document that the relationship between two objects is unchanging by declaring the field that encodes that relationship to be final. This information can be used in program understanding and detection of errors in new code additions. Unfortunately, few fields in programs are actually declared final. Programs often contain fields that could be final, but are not declared so. Moreover, the definition of final has restrictions on initializationthat limit its applicability.

We introduce stationary fields as a generalization of final. A field in a program is stationary if, for every object that contains it, all writes to the field occur before all the reads. Unlike the definition of final fields, there can be multiple writes during initialization, and initialization can span multiple methods.

We have developed an efficient algorithm for inferring which fields are stationary in a program, based on the observation that many fields acquire their value very close to object creation. We presume that an object's initialization phase has concluded when its reference is saved in some heap object. We perform precise analysis only regarding recently created objects. Applying our algorithm to real-world Java programs demonstrates that stationary fields are more common than final fields: 44-59% vs. 11-17% respectively in our benchmarks.

These surprising results have several significant implications. First, substantial portions of Java programs appear to be written in a functional style. Second, initialization of these fields occurs very close to object creation, when very good alias information is available. These results open the door for more accurate and efficient pointer alias analysis.


REFERENCES

Note: OCR errors may be found in this Reference List extracted from the full text article. ACM has opted to expose the complete List rather than only correct and linked references.

1
 
2
3
4
 
5
 
6
7
8
 
9
10
11
12
 
13
 
14
A. Salcianu and M. Rinard. Purity and side effect analysis for Java programs. Lecture Notes in Computer Science, 3385:199--215, 2005.
 
15
Mats Skoglund and Tobias Wrigstad. A mode system for readonly references. In Akos Frohner, editor, Formal Techniques for Java Programs, number 2323 in Object-Oriented Technology, ECOOP 2001 Workshop Reader, pages 30--, Berlin, Heidelberg, New York, 2001. Springer-Verlag. ISBN 3-540-43675-8.
 
16
17
18
19
20
21


Collaborative Colleagues:
Christopher Unkel: colleagues
Monica S. Lam: colleagues