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.

47<br />

...<br />

i − 1<br />

iload 3 iload 0x04 iadd istore 2<br />

i i + 1 i + 2 i + 3 i + 4<br />

(a) Before Load Despecialization<br />

...<br />

i + 5<br />

...<br />

i − 1<br />

iload 0x03 iload 0x04 iadd istore 2<br />

i i + 1 i + 2 i + 3 i + 4 i + 5<br />

(b) After Load Despecialization<br />

...<br />

i + 6<br />

Figure 4.1: An Example of Load Despecialization<br />

values of two local variables onto the operand stack, adds them together and then<br />

stores them back into a different local variable. Such a bytecode sequence would be<br />

generated when a Java language statement of the form a = b + c is compiled.<br />

Each box in the diagram represents one byte within the code stream. The top<br />

portion of the figure shows the bytes that make up the code stream before the specialized<br />

load bytecode has been replaced with its equivalent general purpose form. The<br />

lower half of the diagram shows the same block of code after it has been despecialized.<br />

Notice that despecialization increased the number of bytes used to represent the block<br />

of code because it is now necessary to explicitly specify the index from which each<br />

local variable is loaded using an operand.<br />

Performing this despecialization provides semantically equivalent functionality.<br />

However, because the position that must be loaded is now specified using an operand<br />

byte, additional work must be performed at runtime each and every time that bytecode<br />

is executed. In addition, the size of the code stream is increased by one byte for<br />

each load bytecode that is despecialized. The impacts that these changes have on application<br />

performance were measured. They are reported in Section 4.2. In addition,<br />

the overall impact despecialization had on class file size was also measured. These<br />

results are described in Section 4.3. Finally, the impact making these substitutions<br />

has on the correctness of Java class files is described in Section 4.4.

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

Saved successfully!

Ooh no, something went wrong!