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.

221<br />

10.2.6 Combining Multicodes and a JIT Compiler<br />

The multicode work presented in Chapter 7 and Chapter 8 was conducted entirely<br />

within the context of a Java interpreter. Many modern virtual machines make use<br />

of a JIT compiler in order to improve application performance. Multicodes are very<br />

well suited for use within an interpreter. Furthermore, the author believes that they<br />

may also offer benefits when used in conjunction with a just-in-time compiler.<br />

A JIT compiler converts Java bytecodes to platform specific machine language<br />

instructions at runtime. The amount of time spent on this conversion process is<br />

of great concern since the application’s user is waiting while the conversion process<br />

takes place. Consequently, the thoroughness of the optimizations that are performed<br />

is limited. Any optimization performed must achieve a performance gain after taking<br />

into consideration the amount of time spent performing the optimization [11]. This<br />

is not the case in a traditional optimizer which executes at compile time. In that<br />

context, the only timing concern is that compile time remain reasonable, generally<br />

allowing optimization algorithms to execute until an optimal result is achieved.<br />

If multicodes were introduced into a virtual machine that makes use of a JIT<br />

compiler then the need to perform runtime optimizations would be reduced. Since<br />

the multicodes are determined ahead of time, representing a sequence of several bytecodes,<br />

optimal machine language code can be determined for that sequence ahead of<br />

time as well. Thus, when JIT compilation is performed, optimal machine language<br />

code can be generated for the multicode without requiring any additional optimization<br />

within it. Optimizations will still need to be performed for those portions of<br />

the applications which do not make extensive use of multicodes and to handle the<br />

boundaries between the multicodes. However, these runtime optimizations will be less<br />

critical to the performance of the application because optimal machine language code<br />

has already been generated for the multicodes which account for a large proportion<br />

of the application’s execution.<br />

The benefits multicodes have to a JIT compiler are similar to the benefits afforded<br />

by bytecode idioms. However, unlike bytecode idioms, multicodes are identified from<br />

profiling, ensuring that the sequences considered are actually executed with great<br />

frequency. Multicode substitution also occurs ahead of time, eliminating the need to<br />

perform the substitution when the class file is loaded. Both of these factors allow<br />

longer candidate sequences to be considered. By determining multicodes through<br />

profiling, a computer examines long sequences that are difficult for people to identify.<br />

Performing the substitution ahead of time eliminates any concerns regarding the

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

Saved successfully!

Ooh no, something went wrong!