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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

134<br />

technique still fundamentally follows the same model of execution, repeatedly fetching,<br />

decoding and executing each bytecode as a discrete item 1 . Multicodes change<br />

this model of execution, making it possible to perform the tasks of several bytecodes<br />

together, reducing the total number of transfers of control that are performed during<br />

the execution of the application. This is accomplished by identifying frequently<br />

executed bytecode sequences and then introducing a new multicode that provides<br />

identical functionality.<br />

The newly created multicode is assigned a unique opcode that is not currently used<br />

by the Java Virtual Machine Specification. There are 52 opcodes that fit this criteria.<br />

This count includes those opcodes numbered 203 to 253, for which no functionality<br />

is defined. They will be represented by the mnemonics o203 through o253. It also<br />

includes opcode 186, which has the mnemonic xxxunusedxxx. The Java Virtual<br />

Machine Specification indicates that this bytecode is unused for historical reasons.<br />

Two additional bytecodes are also potentially available. These opcodes are numbered<br />

254 and 255 and have the mnemonics impdep1 and impdep2 respectively. The purpose<br />

of these bytecodes is to provide traps for accessing implementation specific features<br />

that are present in software and hardware respectively. Sun guarantees that these<br />

implementation specific bytecodes will continue to be available even if the Java Virtual<br />

Machine Specification is revised.<br />

The definition of a multicode also includes a description of its operands. The<br />

number of operand bytes is the total number of operand bytes from all of the bytecodes<br />

represented by the multicode. These operand bytes follow the multicode’s opcode<br />

in the same order as they were present in the original sequence. The creation of<br />

the multicode for the bytecode sequence aload getfield is shown graphically in<br />

Figure 7.1. Recall that aload copies a reference to an object from a local variable to<br />

the operand stack. A single operand byte follows the opcode, which specifies which<br />

local variable is copied. The getfield bytecode pops an object reference from the<br />

operand stack, and pushes the value of a field from the object pointed to by the object<br />

reference. Two operand bytes follow the getfield opcode which specify what field<br />

will be accessed.<br />

Performing a multicode substitution decreases the total size of the code stream.<br />

This occurs because only one opcode is present to represent the functionality of the<br />

sequence when a multicode is employed. In comparison, a sequence of n bytecodes<br />

1 The lone exception to this pattern occurs when selective inlining is used in conjunction with<br />

direct threading.

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

Saved successfully!

Ooh no, something went wrong!