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.

213<br />

exceptions if the value being cast is too large to express in the destination data type.<br />

As a result, it appears that these bytecodes can be despecialized to a sequence of logical<br />

operations. However, it remains to be seen if there are requirements stipulated<br />

by the verifier that will not be met once such a substitution is performed.<br />

Despecializing the tableswitch bytecode must also be considered carefully. While<br />

there are no concerns with the verifiability of a functionally equivalent lookupswitch<br />

bytecode, making this substitution has the potential to increase the number of bytes<br />

in the code attribute considerably. Such an increase could violate the maximum code<br />

attribute size of 65536 bytes imposed by the Java Virtual Machine Specification.<br />

Additional work needs to be performed in order to determine if this is a problem in<br />

practice. Performance testing should also be performed in order to determine if there<br />

is a large negative impact on application performance which makes performing this<br />

despecialization impractical.<br />

10.1.2 Further Load / Store Despecializations<br />

The despecializations presented previously reduced the total number of load and store<br />

bytecodes from 50 to 10. However, further reductions may be possible. The work<br />

performed by aload, fload and iload is identical. Each of these bytecodes copies<br />

a four byte block of memory from a local variable to the operand stack. Similarly,<br />

dload and lload perform the same task, copying an 8 byte block of memory. As a<br />

result, it may be possible to reduce the number of load instructions from 5 to 2. One<br />

instruction could be named cat1load. It would be responsible for copying the four<br />

bytes that represent a category one value. Similarly, a new cat2load bytecode would<br />

be responsible for copying the eight bytes that represent a category two value.<br />

It is clear that such a transformation would still provide correct application behaviour,<br />

but it remains to be seen if making this change would negatively impact the<br />

ability of the virtual machine to perform verification. Corresponding arguments can<br />

also be made about the 5 store bytecodes that were not despecialized previously. As a<br />

result, performing this transformation in addition to the load and store despecializations<br />

described previously would reduce the total number of load and store bytecodes<br />

required from 50 to 4.

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

Saved successfully!

Ooh no, something went wrong!