Abstract
We present a lightweight type-and-effect system for Java programs that features two major innovations over extant object-oriented effects systems: initialization effects, which are writes to an object’s state while it is being constructed, and quiescing fields, which are fields that are never written after an object is constructed. We also present a novel taxonomy of degrees of method purity in object-oriented programs, which characterizes methods whose effects are confined to their receiver object. Finally, we find significant amounts of mostly-functional behavior in realistic Java programs: in the benchmarks we analyzed, between 48–53% of declared fields were identifiable as quiescing and between 24–78% of dynamic field reads were from quiescing fields.
Preview
Unable to display preview. Download preview PDF.
Similar content being viewed by others
References
Knight, T.: An architecture for mostly functional languages. In: LFP 1986: Proceedings of the 1986 ACM conference on LISP and functional programming, pp. 105–112. ACM, New York (1986)
Blackburn, S.M., Garner, R., Hoffman, C., Khan, A.M., McKinley, K.S., Bentzur, R., Diwan, A., Feinberg, D., Frampton, D., Guyer, S.Z., Hirzel, M., Hosking, A., Jump, M., Lee, H., Moss, J.E.B., Phansalkar, A., Stefanović, D., VanDrunen, T., von Dincklage, D., Wiedermann, B.: The DaCapo benchmarks: Java benchmarking development and analysis. In: OOPSLA 2006: Proceedings of the 21st annual ACM SIGPLAN conference on Object-Oriented Programing, Systems, Languages, and Applications. ACM Press, New York (2006)
Vallée-Rai, R., Co, P., Gagnon, E., Hendren, L., Lam, P., Sundaresan, V.: Soot - a java bytecode optimization framework. In: Proceedings of the 1999 conference of the Centre for Advanced Studies on Collaborative research, p. 13. IBM Press (1999)
Benton, W.C., Fischer, C.N.: Interactive, scalable, declarative program analysis: from prototype to implementation. In: PPDP 2007: Proceedings of the 9th ACM SIGPLAN international conference on Principles and practice of declarative programming, pp. 13–24. ACM, New York (2007)
Rocha, R., Silva, F., Costa, V.S.: On Applying Or-Parallelism and Tabling to Logic Programs. Theory and Practice of Logic Programming Systems 5, 161–205 (2005)
Lucassen, J.M., Gifford, D.K.: Polymorphic effect systems. In: Proceedings of the 15th ACM SIGPLAN-SIGACT symposium on Principles of programming languages, pp. 47–57. ACM Press, New York (1988)
Greenhouse, A., Boyland, J.: An object-oriented effects system. In: Guerraoui, R. (ed.) ECOOP 1999. LNCS, vol. 1628, pp. 205–229. Springer, Heidelberg (1999)
Gosling, J., Joy, B., Steele, G., Bracha, G.: The Java Language Specification. Addison-Wesley, Boston (2000)
Leavens, G.T., Baker, A.L., Ruby, C.: Preliminary design of JML: a behavioral interface specification language for Java. Technical Report TR98-06, Department of Computer Science, Iowa State University, Ames, Iowa (1998)
Leavens, G.T., Baker, A.L., Ruby, C.: Preliminary design of JML: a behavioral interface specification language for Java. SIGSOFT Softw. Eng. Notes 31, 1–38 (2006)
Sălcianu, A., Rinard, M.C.: Purity and side effect analysis for Java programs. In: Cousot, R. (ed.) VMCAI 2005. LNCS, vol. 3385, pp. 199–215. Springer, Heidelberg (2005)
Tofte, M., Talpin, J.P.: Region-based memory management. Information and Computation (1997)
Bierman, G.M., Parkinson, M.J.: Effects and effect inference for a core Java calculus. In: Bono, V., Bugliesi, M. (eds.) Electronic Notes in Theoretical Computer Science, vol. 82. Elsevier, Amsterdam (2003)
Talpin, J., Jouvelot, P.: Polymorphic type, region and effect inference. Journal of Functional Programming 2, 245–271 (1992)
Cherem, S., Rugina, R.: A practical escape and effect analysis for building lightweight method summaries. In: Krishnamurthi, S., Odersky, M. (eds.) CC 2007. LNCS, vol. 4420, pp. 172–186. Springer, Heidelberg (2007)
Barnett, M., Naumann, D.A., Schulte, W., Sun, Q.: 99.44. In: ECOOP Workshop on Formal Techniques for Java-like Programs (FTfJP), pp. 11–19 (2004)
Barnett, M., Fändrich, M., Garbervetsky, D., Logozzo, F.: Annotations for (more) precise points-to analysis. In: IWACO 2007: ECOOP International Workshop on Aliasing, Confinement and Ownership in Object-Oriented Programming (2007)
Ma, K.K., Foster, J.S.: Inferring aliasing and encapsulation properties for java. In: OOPSLA 2007: Proceedings of the 22nd annual ACM SIGPLAN conference On Object Oriented Programming Systems and Applications, pp. 423–440. ACM Press, New York (2007)
Porat, S., Biberstein, M., Koved, L., Mendelson, B.: Automatic detection of immutable fields in java. In: CASCON 2000: Proceedings of the 2000 conference of the Centre for Advanced Studies on Collaborative research, p. 10. IBM Press (2000)
Unkel, C., Lam, M.S.: Automatic inference of stationary fields: a generalization of Java’s final fields. In: Necula, G.C., Wadler, P. (eds.) POPL, pp. 183–195. ACM, New York (2008)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2008 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Benton, W.C., Fischer, C.N. (2008). Mostly-Functional Behavior in Java Programs. In: Jones, N.D., Müller-Olm, M. (eds) Verification, Model Checking, and Abstract Interpretation. VMCAI 2009. Lecture Notes in Computer Science, vol 5403. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-93900-9_7
Download citation
DOI: https://doi.org/10.1007/978-3-540-93900-9_7
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-93899-6
Online ISBN: 978-3-540-93900-9
eBook Packages: Computer ScienceComputer Science (R0)