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.

52<br />

...<br />

i − 1<br />

fconst 1 fstore 1 dconst 4 dstore 2<br />

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

...<br />

i + 5<br />

(a) Before Non-Integer Constant Despecialization<br />

...<br />

i − 1<br />

ldc 0x20 fstore 1 ldc2 w 0x00 0x1e dstore 2<br />

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

...<br />

i + 7<br />

(b) After Non-Integer Constant Despecialization to ldc / ldc w<br />

Figure 4.4: An Example of Non-Integer Constant Despecialization<br />

4.1.5 Branch Despecialization<br />

Two different series of integer comparison conditional branch bytecodes are included<br />

as part of the Java Virtual Machine Specification. One set is used to compare an<br />

integer value to zero. The branches in this set are named ifeq, ifne, ifle, iflt,<br />

ifgt, and ifge. The last two letters indicate what relationship is being tested. For<br />

example, ifeq indicates that the branch is testing for equality between the integers.<br />

The symbol will be used to represent any one of the two letter abbreviations<br />

that appear at the end of the bytecode names. Consequently, an arbitrary branch<br />

bytecode in this set will be referred to as if.<br />

The second set of integer comparison bytecodes provided by the Java Virtual<br />

Machine Specification is used to compare two arbitrary integer values. Both of the<br />

required values are popped from the stack, tested using the appropriate relational<br />

operator and then a branch is performed if the condition being tested is true. The<br />

bytecodes in this set follow the naming pattern if icmp.<br />

Given these two sets of branch bytecodes, it is possible to despecialize the first<br />

set by expressing their functionality using the second set. This is accomplished by<br />

explicitly placing the zero value being tested on the stack. Initially this value is<br />

generated with an iconst 0 bytecode. When both integer constant despecialization<br />

and branch despecialization are performed, the branches are despecialized first so<br />

that all iconst 0 bytecodes generated during that branch despecialization process<br />

are subsequently despecialized into bipush bytecodes.<br />

Figure 4.5a shows the block of code representing a statement of the form if (a<br />

< 0) ... before any despecialization has been performed. It is shown again once

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

Saved successfully!

Ooh no, something went wrong!