13.10.2014 Views

OPTIMIZING THE JAVA VIRTUAL MACHINE INSTRUCTION SET BY ...

OPTIMIZING THE JAVA VIRTUAL MACHINE INSTRUCTION SET BY ...

OPTIMIZING THE JAVA VIRTUAL MACHINE INSTRUCTION SET BY ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

36<br />

3.2 Other Optimization Strategies<br />

Java provides many features related to safety and security. These features, along<br />

with platform independence, object oriented programming structures and dynamic<br />

class loading have a large negative impact on application performance. A variety of<br />

strategies have been developed to help mitigate the performance cost associated with<br />

these features. Many of these strategies are discussed in the subsections below.<br />

3.2.1 Array Bounds Check Removal<br />

The Java Language Specification dictates that a check must be performed to ensure<br />

that every access to an array element is within the bounds of the array. These<br />

checks increase the expense of accessing an array element considerably. In some<br />

applications, the requirement to perform array bounds checking has been shown to<br />

increase application runtime by a factor of two [20] while other studies indicate that<br />

these checks increase runtime by a factor of as much as five [85]. Consequently,<br />

research has been performed which attempts to minimize the number of array bounds<br />

check operations.<br />

Array bounds checks can safely be omitted when it is known conclusively that<br />

the element being accessed is within the bounds of an array. A simple example of<br />

such a case is a for loop where the loop control variable is bounded by a value that<br />

is known to be smaller than the size of the array. In this situation, all array bounds<br />

checks within the loop can be eliminated safely. A variety of different array bounds<br />

removal techniques have been developed [75, 76, 22, 84, 122, 121, 35]. Each of these<br />

techniques has its own strengths and weaknesses.<br />

3.2.2 Providing Extra Data to the VM<br />

Many optimization strategies work with Java class files which contain only the information<br />

included in them by standard versions of javac. However, some optimizations<br />

are eased considerably by including additional information. The Java class file format<br />

provides a mechanism for providing this information in a manner compatible with all<br />

virtual machines through the use of attributes.<br />

Attributes are pieces of information within a Java class file. They can be associated<br />

with the class itself or they can be associated with a specific method or field.<br />

The Java Virtual Machine Specification includes the definition of several standard<br />

attributes such as the code attribute which contains the bytecodes representing a

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!