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.

175<br />

Such bytecodes have a variable impact on the stack pointer making collapsing all<br />

stack adjustments into a single adjustment difficult or impossible. This complicates<br />

the process of determining which stack offsets actually refer to the same value, making<br />

it more difficult to perform copy propagation and unnecessary assignment removal.<br />

The optimization process is also complicated by the many bytecodes that read<br />

operands from the code stream. In Kaffe, the codelets that make use of these operands<br />

commonly store them into a local variable named idx on one line and then use the<br />

local variable as part of an assignment. Consequently, it is necessary to track all reads<br />

and writes of this local variable in order to know if the expression local vars[idx]<br />

refers to the same memory location at different points within the method.<br />

These complications have prevented the author from developing a general purpose<br />

optimizer for the codelets. Instead, a pattern matching approach was taken<br />

similar to the bytecode idioms used in IBM’s virtual machine [103]. The general idea<br />

was to select patterns that occurred in the 50 most frequently executed bytecodes<br />

for 222 mpegaudio that had optimization opportunities that the compiler would be<br />

unable to make use of. The patterns selected are listed in Table 7.5. The symbol<br />

is used to represent an arithmetic or logical operation which removes two<br />

integer values from the stack in order to compute an integer result which is pushed<br />

onto the stack.<br />

While the optimizations listed in Table 7.5 give the ability to improve the performance<br />

of each individual codelet, they don’t provide a technique for determining<br />

multicodes based on their optimization potential in addition to the number of occurrences<br />

of the sequence and the number of transfers removed. As a result, it was<br />

necessary to develop a new technique for evaluating candidate sequences, which is<br />

presented in the following section.<br />

7.8 Scoring that Considers the Complete Impact<br />

of a Multicode<br />

Each of the scoring techniques considered previously failed to examine the optimization<br />

potential of the multicode sequence. While Equation 7.13 presents a closed<br />

form that is easily computed, determining the value of ∆ x1 x 2 x 3 ...x n→ is non-trivial.<br />

The difficulty arises from the fact that it is necessary to have a measure of the difference<br />

in performance between the optimized multicode and the sequence of bytecodes<br />

that it represents. This difference can be separated into the difference between

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

Saved successfully!

Ooh no, something went wrong!