ABSTRACT
In many scenarios a field holds a value that is constant beyond a certain point in the execution of the program. However, Java only allows it to be marked as being final in relation to the control-flow of the program. We present a language extension whereby the programmer can express that a field will have an unchanging value once it satisfies a given constraint. That is the constraint is the guarantee of finality as opposed to the particular code region. A field holding an unchanging value is said to be stationary. The resulting change of the language has similar pitfalls to keywords that express immutability in a dynamic system. However, it provides a number of advantages: ability for improved partial evaluation and specialisation in dynamic compilation, simple inspection to show thread safety and richer information to the runtime environment.
We present an implementation of our proposed language extension to Java in the Jikes Research Virtual Machine (RVM). We use class loading as a case study of where lazy initialisation occurs. In code that is frequently executed the probability of a referenced class being uninitialised is less than 1% for method accesses and for fields typically 0%. We create an optimization framework that uses this information to perform specialisation and partial evaluation. We demonstrate that on average 61.32% of accesses occur to fields in their stationary state. We demonstrate that stationary information allows optimizations achieving a best case 3.90% speedup of benchmark applications, and 1.67% speedup on average.
- Alpern, B., Attanasio, C. R., Barton, J. J., Burke, M. G., P. Cheng, Choi, J.-D., Cocchi, A., Fink, S. J., Grove, D., Hind, M., Hummel, S. F., Libber, D., Litvinov, V., Mergen, M. F., Ngo, T., Russell, J. R., Sarkar, V., Serrano, M. J., Shepherd, J. C., Smith, S. E., Sreedhar, V. C., Srinivasan, H., and Whaley, J. The Jalapeño virtual machine. The IBM Systems Journal 39, 1 (2000). Google ScholarDigital Library
- Arnold, M., Fink, S., Grove, D., Hind, M., and Sweeney, P. F. Adaptive optimization in the Jalapeño JVM. ACM SIGPLAN Notices 35, 10 (2000), 47--65. Google ScholarDigital Library
- Bilianou, P. Runtime value specialization. M.phil., School of Computer Science, The University of Manchester., 2007.Google Scholar
- 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., and Wiedermann, B. The DaCapo benchmarks: Java benchmarking development and analysis. In OOPSLA '06: Proceedings of the 21st annual ACM SIGPLAN conference on Object-Oriented Programing, Systems, Languages, and Applications (New York, NY, USA, Oct. 2006), ACM Press. Google ScholarDigital Library
- Charles, P., Grothoff, C., Saraswat, V., Donawa, C., Kielstra, A., Ebcioglu, K., von Praun, C., and Sarkar, V. X10: an object-oriented approach to non-uniform cluster computing. In OOPSLA '05: Proceedings of the 20th annual ACM SIGPLAN conference on Object oriented programming, systems, languages, and applications (New York, NY, USA, 2005), ACM, pp. 519--538. Google ScholarDigital Library
- Goetz, B., Peierls, T., Bloch, J., Bowbeer, J., Holmes, D., and Lea, D. Java Concurrency in Practice. Addison-Wesley, September 2006. Google ScholarDigital Library
- Gosling, J., Joy, B., Steele, G., and Bracha, G. The Java Language Specification, third ed. Addison-Wesley, 2005. Google ScholarDigital Library
- Jones, R., and Lins, R. Garbage Collection: Algorithms for Automatic Dynamic Memory Management. John Wiley & Sons, 1996. Google ScholarDigital Library
- Kniesel, G., and Theisen, D. JAC - Java with transitive readonly access control. In Intercontinental Workshop on Aliasing in Object-Oriented Systems (IWAOOS) (1999).Google Scholar
- Lindholm, T., And Yellin, F. The Java Virtual Machine Specification, second ed. Addison-Wesley, Reading, MA, USA, 1999. Google ScholarDigital Library
- MA, M. J. M., Wang, G.-L., And Lau, F. C. M. Jessica: Java-enabled single-system-image computing architecture. Journal of Parallel and Distributed Computing 60, 10 (2000), 1194--1222. Google ScholarDigital Library
- Muchnick, S. S. Advanced compiler design and implementation. Morgan Kaufmann Publishers Inc., San Francisco, CA, USA, 1997. Google ScholarDigital Library
- Pechtchanski, I., And Sarkar, V. Immutability specification and its applications. Concurrency and Computation: Practice and Experience 17, 5--6 (April/May 2005), 639--662. Special Issue: Java Grande/Iscope 2002. Google ScholarDigital Library
- Pugh, W. JSR 305: Annotations for software defect detection. http://jcp.org/en/jsr/detail?id=305, September 2006.Google Scholar
- Röjemo, N. Garbage collection, and memory efficiency, in lazy funclional languages. PhD thesis, Chalmers Univ. of Technology, Göteburg, 1995.Google Scholar
- Singer, J., Brown, G., Watson, I., And Cavazos, J. Intelligent selection of application-specific garbage collectors. In International Symposium on Memory Management (Oct. 2007), pp. 91--102. Google ScholarDigital Library
- Spec Jvm98 benchmarks. http://www.spec.org/osg/jvm98/, 1998.Google Scholar
- Tschantz, M. S., And Ernst, M. D. Javari: Adding reference immutability to Java. In Object-Oriented Programming Systems, Languages, and Applications (OOPSLA) (San Diego, CA, USA, October 18--20, 2005), pp. 211--230. Google ScholarDigital Library
- Unkel, C., And Lam, M. S. Automatic inference of stationary fields: a generalization of java's final fields. In POPL '08: Proceedings of the 35th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languages (New York, NY, USA, 2008), ACM, pp. 183--195. Google ScholarDigital Library
Index Terms
- Constraint based optimization of stationary fields
Recommendations
Building Java Applets by Using DJ - A Java-based Constraint Language
COMPSAC '99: 23rd International Computer Software and Applications ConferenceDJ (Declarative Java) is an extension of Java that supports constraint programming. On the one hand, DJ can serve as a high-level specification language for Java applets. To construct a Graphic User Interface (GUI) with DJ, the users only need to ...
Solving dynamic constraint optimization problems using ICHEA
ICONIP'12: Proceedings of the 19th international conference on Neural Information Processing - Volume Part IIIMany real-world constrained problems have a set of predefined static constraints that can be solved by evolutionary algorithms (EAs) whereas some problems have dynamic constraints that may change over time or may be received by the problem solver at run ...
Comments