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.
Talk to us
Join us for a 30 min session where you can share your feedback and ask us any queries you have
Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.