Profiling Field Initialisation in Java
详细信息    查看全文
  • 作者:Stephen Nelson (18)
    David J. Pearce (18)
    James Noble (18)
  • 刊名:Lecture Notes in Computer Science
  • 出版年:2013
  • 出版时间:2013
  • 年:2013
  • 卷:7687
  • 期:1
  • 页码:308-313
  • 全文大小:256KB
  • 参考文献:1. Haack, C., Poll, E.: Type-based object immutability with flexible initialization. Technical Report ICIS-R09001, Radboud University Nijmegen (January 2009)
    2. F?hndrich, M., Xia, S.: Establishing object invariants with delayed types. In: OOPSLA, pp. 337-50 (2007)
    3. Leino, K.R.M., Müller, P., Wallenburg, A.: Flexible Immutability with Frozen Objects. In: Shankar, N., Woodcock, J. (eds.) VSTTE 2008. LNCS, vol.?5295, pp. 192-08. Springer, Heidelberg (2008) CrossRef
    4. Bloch, J.: Effective Java. Prentice Hall PTR (2008)
    5. Unkel, C., Lam, M.S.: Automatic inference of stationary fields: a generalization of Java’s final fields. In: POPL, pp. 183-95 (2008)
    6. Summers, A.J., Müller, P.: Freedom before commitment: a lightweight type system for object initialisation. In: OOPSLA, pp. 1013-032. ACM (2011)
    7. Jdk 6 java virtual machine tool interface (JVMTI) (2008)
    8. Bruneton, E.: Asm 3.0 a java bytecode engineering library (2007), http://download.forge.objectweb.org/asm/asmguide.pdf
    9. Nelson, S.: Measuring Equality and Immutability in Object-Oriented Programs. PhD thesis, School of Engineering and Computer Science, Victoria University of Wellington, NZ (submitted, 2012)
    10. Agesen, O., Garthwaite, A.: Efficient object sampling via weak references. In: Proc. ISMM, pp. 121-26 (2000)
    11. Pearce, D.J., Webster, M., Berry, R., Kelly, P.H.J.: Profiling with AspectJ. Software: Pracice and Experience?37(7), 747-77 (2007) CrossRef
    12. Goldberg, A., Havelund, K.: Instrumentation of java bytecode for runtime analysis. In: FTfJP (2003)
    13. Xu, G.H., Rountev, A.: Precise memory leak detection for java software using container profiling. In: ICSE, pp. 151-60. ACM (2008)
    14. Blackburn, S.M., Garner, R., Hoffmann, C., Khang, 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, pp. 169-90 (2006)
    15. Mitchell, N.: The Runtime Structure of Object Ownership. In: Hu, Q. (ed.) ECOOP 2006. LNCS, vol.?4067, pp. 74-8. Springer, Heidelberg (2006) CrossRef
    16. Liskov, B., Guttag, J.V.: Abstraction and Specification in Program Development. MIT Press/McGraw-Hill (1986)
    17. Odersky, M.: Programming in Scala. Artima, Inc. (2008)
    18. Porat, S., Biberstein, M., Koved, L., Mendelson, B.: Automatic detection of immutable fields in Java. In: Proc. CASCON (1990)
    19. Nelson, S., Pearce, D.J., Noble, J.: Understanding the Impact of Collection Contracts on Design. In: Vitek, J. (ed.) TOOLS 2010. LNCS, vol.?6141, pp. 61-8. Springer, Heidelberg (2010) CrossRef
    20. Pechtchanski, I., Sarkar, V.: Immutability specification and its applications. Concurrency and Computation: Practice and Experience, 639-62 (2005)
    21. Qi, X., Myers, A.C.: Masked types for sound object initialization. In: POPL, pp. 53-5 (2009)
    22. Gil, J(Y.), Shragai, T.: Are We Ready for a Safer Construction Environment? In: Drossopoulou, S. (ed.) ECOOP 2009. LNCS, vol.?5653, pp. 495-19. Springer, Heidelberg (2009) CrossRef
  • 作者单位:Stephen Nelson (18)
    David J. Pearce (18)
    James Noble (18)

    18. Victoria University of Wellington, Wellington, New Zealand
  • ISSN:1611-3349
文摘
Java encourages programmers to use constructor methods to initialise objects, supports final modifiers for documenting fields which are never modified and employs static checking to ensure such fields are only ever initialised inside constructors. Unkel and Lam observed that relatively few fields are actually declared final and showed using static analysis that many more fields have final behaviour, and even more fields are stationary (i.e. all writes occur before all reads). We present results from a runtime analysis of 14 real-world Java programs which not only replicates Unkel and Lam’s results, but suggests their analysis may have under-approximated the true figure. Our results indicate a remarkable 72-82% of fields are stationary, that final is poorly utilised by Java programmers, and that initialisation of immutable fields frequently occurs after constructor return. This suggests that the final modifier for fields does a poor job of supporting common programming practices.

© 2004-2018 中国地质图书馆版权所有 京ICP备05064691号 京公网安备11010802017129号

地址:北京市海淀区学院路29号 邮编:100083

电话:办公室:(+86 10)66554848;文献借阅、咨询服务、科技查新:66554700