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.

115<br />

Implementing alignment rules under the current system where method parameters<br />

appear as the first local variables is also an option. However, it could lead to situations<br />

where the specialized bytecodes go completely unutilized. Consider the case where<br />

an instance method has 4 parameter of type double and the specialized bytecodes<br />

for handling doubles are dload 0, dload 2, dload 4 and dload 6. In this example,<br />

none of the specialized bytecodes would be used because the receiver object for the<br />

method would occupy slot 0, causing the remaining parameters to reside in slots 1,<br />

3, 5 and 7, requiring the dload bytecode to load or store the parameter values. This<br />

problem could be partially resolved if the compiler intentionally introduced an empty<br />

pad slot to align the values when necessary. However this still does not overcome<br />

the problem of trying to decide what slots should have specialized bytecodes so as to<br />

avoid specializing on method parameters while still encompassing the local variables<br />

in all cases. Padding may also introduce a non-trivial amount of overhead for methods<br />

that have a list of parameters that alternate between category 1 and category 2 types<br />

since a padding slot would have to be introduced after every category 1 parameter in<br />

order to align the following category 2 parameter with an even numbered slot.<br />

A second alternative for improving specialized bytecode utilization would be to<br />

completely separate the parameter values from the local variable array. Such a system<br />

would require the introduction of new bytecodes dedicated to the task of accessing<br />

method parameters. At a minimum this would require a pair of bytecodes similar<br />

to getfield and putfield designed for accessing parameters. In practice, it may<br />

be more desirable to include a series of typed parameter load and parameter store<br />

instructions so as to avoid the overhead associated with resolving the types of method<br />

parameters. Separating the local variables from the parameters in this manner would<br />

give the compiler complete freedom in assigning programmer declared variables to<br />

slots, allowing it to make the best possible use of the available specialized bytecodes<br />

for accessing local variables.<br />

The load bytecodes executed with least frequency were also considered. Initially<br />

it was anticipated that this distribution would consist entirely of general purpose<br />

bytecodes that executed extremely infrequently. However, this was not the case.<br />

Figure 6.2 shows the distribution of the 40 least frequently executed load bytecodes.<br />

This list includes 4 specialized bytecodes: lload 1, lload 2, fload 2 and<br />

fload 0. The presence of any specialized bytecodes in this list is a serious concern.<br />

In this specific case, 4 of the 40 worst possible choices for specialized bytecodes have<br />

specialized bytecodes to represent them. It is also observed that all 4 of the specialized<br />

bytecodes access values that are type float or type long. The presence of

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

Saved successfully!

Ooh no, something went wrong!