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.

114<br />

The technique used by the Java virtual machine to pass the remainder of the<br />

method parameters to the called scope also contributes to the difficulty of making<br />

good selections for specialized load bytecodes. The analysis presented earlier in this<br />

section came to the conclusion that the majority of the most frequently executed load<br />

bytecodes are used to access programmer declared local variables rather than method<br />

parameters. Because method parameters appear ahead of programmer declared variables<br />

in the local variable slots it is impossible to select a small number of specialized<br />

bytecodes that will work well for all methods. Selecting specialized values for the first<br />

slots will work well in methods that take very few parameters. However methods that<br />

take more parameters will be unable to utilize the specialized bytecodes effectively<br />

because their parameters are already occupying those slots. Alternatively, specialized<br />

bytecodes could be introduced for later slots instead of slots 0 through 3. While such<br />

a system would work well for methods with several parameters and local variables,<br />

methods with few parameters and local variables would be completely unable to use<br />

the specialized bytecodes.<br />

Consequently, when future virtual machines are designed and implemented, it is<br />

recommended that their creators consider alternatives for accessing parameter values<br />

in the called scope in order to facilitate more effective use of specialized bytecodes.<br />

One option would be to have method parameters appear as the last local variables<br />

rather than as the first local variables. Such a design decision would give compiler<br />

writers considerably more freedom in ordering the local variables so as to make best<br />

use of specialized bytecodes since the compiler would be free to assign those local<br />

variables that are used the most to the slots for which specialized bytecodes exist.<br />

In those methods without any programmer defined local variables the method parameters<br />

would end up residing in the first slots in the local variable array, allowing<br />

specialized bytecodes to be utilized in these methods as well.<br />

Using a system where parameters occupy the last slots in the local variable array<br />

would also permit the creation of alignment guidelines for category 2 data types.<br />

Under such a system, specialized bytecodes for category 2 data types would only<br />

exist for even numbered local variable slots. This system would make more effective<br />

use of the category 2 loads because all specialized load bytecodes for a single data<br />

type could be used within the same method. Under the current JVM design, it is<br />

impossible for the specialized bytecodes dload 0 and dload 1 to reside within the<br />

same method because each double value occupies 2 adjacent slots. Consequently,<br />

while there are 4 specialized load bytecodes allocated for accessing variables with the<br />

double data type, only half of them can be used in any given method.

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

Saved successfully!

Ooh no, something went wrong!