Dr. David J. Pearce

Optimising Java Programs with Pure Functions

Author(s). Andrew Walbran.

Venue. Final Year Project (COMP489) Thesis, Victoria University of Wellington, 2008.

Abstract. Java programs often contain expressions involving method calls that are executed many times in a loop but will always return the same value, such as checking the length of a collection through which the loop is iterating. This can help to make the code readable, but makes it less efficient to execute than it could be. Current optimising compilers are generally unable to perform loop invariant code motion on such method calls and object field accesses due to a lack of knowledge of functional purity, aliasing and other information about the program structure. We propose that the problems of finding this information and of using it for optimisation be separated by the use of a number of annotations which we introduce. We describe under what conditions such optimisations can be made, and implement our scheme in JKit.

Related Project(s)