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.

56<br />

accessed with ldc. This is a widening despecialization because the number of bytes<br />

used to store the offset into the constant pool has increased from one byte to two<br />

bytes.<br />

The final two bytecodes that are despecialized through widening are jsr and goto.<br />

Each of these bytecodes requires two operand bytes which specify the displacement<br />

of the branch within the code stream. The bytecodes jsr w and goto w perform<br />

corresponding tasks. However, they express the displacement using four bytes. Consequently<br />

this is a widening despecialization because the number of bytes used to<br />

express the displacement increases from two bytes to four bytes.<br />

4.1.7 Other Despecializations<br />

Our final category of despecializations covers nine despecializations that have not yet<br />

been implemented. The first three of these can be considered as a third form of branch<br />

despecialization. This form of despecialization introduces a goto bytecode which<br />

performs an unconditional branch. In addition, both the original branch bytecode and<br />

its branch target are modified as shown in Figure 4.7. Making these modifications<br />

allows those branch bytecodes that test for equality – if icmpeq, if acmpeq and<br />

ifnull – to be despecialized by expressing their functionality in terms of inequality.<br />

It is also possible to replace three typecast bytecodes, i2c, i2b and i2s, with<br />

semantically equivalent sequences of two bytecodes. However it remains to be seen if<br />

these typecast bytecode despecializations cause difficulties with the verification process<br />

that ensures the correctness and security of Java class files loaded by the virtual<br />

machine. The typecast bytecodes and their semantically equivalent despecialized<br />

forms are listed as part of Table 4.4.<br />

The iinc bytecode permits the value of a local variable to be adjusted by a small<br />

constant integer value in an efficient manner. In its basic form, it permits any of<br />

the first 256 local variables that have integer type to be adjusted by a value between<br />

-128 and 127 using a single bytecode. It also supports a wide format that allows<br />

any local variable with integer type to be adjusted by a value between -32768 and<br />

32767. When despecialization is performed each occurrence of iinc is replaced by<br />

the bytecode sequence iload ldc w iadd istore. Note that ldc w is used in<br />

this sequence under the assumption that the despecializations described previously<br />

are also being performed. If this is not the case, any of the iconst , bipush<br />

or sipush bytecodes could be used as appropriate for the value being applied to the<br />

local variable.

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

Saved successfully!

Ooh no, something went wrong!