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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

93<br />

difference in performance due to despecialization. These results are contrary to what<br />

was initially expected before work in this area was conducted, as it was assumed<br />

that specialized bytecodes existed because they significantly improved application<br />

performance.<br />

When this unexpected behaviour was observed, the architecture of the Java Virtual<br />

Machine was examined. Considering its architecture revealed that there are at<br />

least two reasons why this initially unanticipated behaviour occurred:<br />

Optimization: Modern Java Virtual Machines perform a variety of advanced<br />

optimizations. This includes making use of a just in time compiler<br />

which converts Java bytecodes to architecture specific machine language<br />

instructions at runtime. It is the use of this optimization strategy which<br />

contributes to the minimal impact despecialization has on application performance.<br />

Many of the despecializations described previously are performed by replacing<br />

an instruction that does not require any operands with a general<br />

purpose bytecode that explicitly specifies a value as an operand. This<br />

operand was necessary when the specialized bytecode was employed because<br />

the necessary value was dictated by the definition of the specialized<br />

instruction. When JIT compilation is performed, the general purpose<br />

bytecode is converted to one or more machine language instructions. The<br />

operand bytes are decoded during the compilation process and the values<br />

they represent are used directly. Consequently, it is not necessary<br />

to decode the operand bytes again once JIT compilation has been performed.<br />

Similarly, the constant value dictate by the specialized bytecode<br />

can also be used directly during the JIT compilation process. Consequently,<br />

the JIT compiler is able to generate identical machine code for<br />

both the specialized bytecode and its equivalent general purpose form.<br />

For example, the machine code generated for the specialized instruction<br />

iload 0 is identical to the machine code generated for the general purpose<br />

bytecode iload 0x00. As a result, no difference in execution performance<br />

should be observed once JIT compilation has been performed.<br />

Execution Frequency: Examining the frequency of execution of the<br />

specialized bytecodes reveals the second reason that some specialized bytecodes<br />

have little impact on application performance. The profiling conducted<br />

for this study revealed that the specialized bytecodes dstore 0,

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

Saved successfully!

Ooh no, something went wrong!