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.

38<br />

regardless of the technique selected, virtual method dispatch still requires additional<br />

work compared to non-virtual method dispatch. Furthermore, because the exact<br />

method being invoked is not known until runtime, virtual method dispatch makes<br />

other optimizations such as method inlining much more challenging.<br />

Method devirtualization can be used to help overcome the cost of virtual methods.<br />

Numerous devirtualization techniques have been developed for languages other than<br />

Java. However, many of them are not applicable because they rely on whole program<br />

analysis at compile time. Because Java permits class files to be loaded dynamically,<br />

it is possible that some class files will not be made available until runtime, making<br />

such techniques inappropriate.<br />

Several new techniques have been developed to permit method devirtualization in<br />

Java. One option is to assume that the entire set of classes that will be utilized by<br />

the application is available at compile time. Another option is to perform a test each<br />

time the call site is reached in order to determine if inlined code can be executed or<br />

virtual method dispatch must be performed [30]. Techniques have also been proposed<br />

which perform devirtualization and method inlining under the assumption that no<br />

additional classes will be loaded. However, if a class is loaded that invalidates that<br />

assumption, code patching is used in order to introduce the necessary virtual method<br />

dispatch [66]. A similar technique is also employed by the Java HotSpot compiler [4].<br />

Other techniques that can be used include on-stack replacement [58] and pre-existence<br />

[39].<br />

3.2.4 Minimizing Synchronization Operations<br />

The Java programming language provides the ability to start multiple threads of<br />

execution within an application. Synchronization operations are necessary in order<br />

to ensure that accesses to data structures which are shared across these threads of<br />

execution are performed safely. Consequently, the Java library makes extensive use<br />

of synchronization operations.<br />

Unfortunately synchronization operations are costly. One optimization strategy<br />

has been to reduce the cost of synchronization operations directly by performing each<br />

locking or unlocking operation as efficiently as possible [17]. Other researchers have<br />

developed techniques to remove synchronization operations that are proved to be<br />

unnecessary [34, 97, 101]. It has been shown that reducing the number of synchronization<br />

operations performed by the application can improve application runtime by<br />

as much as 36 percent [23].

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

Saved successfully!

Ooh no, something went wrong!