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.

112<br />

to access local variables rather than method parameters. In almost all cases, these<br />

are programmer declared variables. While these local variables could be temporaries<br />

introduced during compilation, such temporaries are uncommon in Java because the<br />

operand stack is normally used to hold such values.<br />

The four general purpose bytecodes that appear among the 10 most executed<br />

load bytecodes are iload 0x08 at position 4, iload 0x05 at position 6, iload 0x0a<br />

at position 8 and iload 0x04 at position 10. These bytecodes are frequently executed<br />

because they all typically represent programmer declared variables rather than<br />

method parameters. The iload 0x04 bytecode will only be used to access a method<br />

parameter in the 4 percent of methods invoked that have 5 or more parameters. The<br />

remaining general purpose bytecodes are used to access method parameters in an<br />

even smaller proportion of the methods invoked. As a result, it is known that these<br />

bytecodes are being used to access programmer declared local variables most of the<br />

time.<br />

Continuing this analysis further reveals that the majority of the bytecodes that<br />

appear in the top 40 load instructions are typically being used to access programmer<br />

declared local variables. This has occurred because programmers generally write<br />

code that accesses the method parameters a small number of times. Local variables<br />

are then use to complete the computation. Generally, the number of local variable<br />

references required to complete the computation is much larger than the number of<br />

references used to access the parameter values, resulting in the behaviour described<br />

here. The exceptions to this observation are the aload 0, aload 1 and iload 1<br />

bytecodes noted already and the dload 0 and dload 1 bytecodes which appear among<br />

the most executed load bytecodes in positions 23 and 25 respectively.<br />

Further analysis of the dload 0 and dload 1 bytecodes reveals that they are primarily<br />

contributed by a small number of benchmarks. Of these, the Java Grande<br />

Forum Series benchmark contributes by far the most, with over 9 percent of its bytecodes<br />

executed being dload 0. This benchmark also executes dload 1 frequently,<br />

with this bytecode representing nearly 7 percent of the instructions executed by the<br />

benchmark.<br />

An informal analysis revealed that most of the dload 0 bytecodes executed were<br />

used for parameter loading in static mathematical methods such as Math.abs, Math.-<br />

pow and Double.isInfinite. These method invocations were the result of the fact<br />

that the Series benchmark performed a 1000 segment trapezoidal integration of a<br />

function many times. The frequent use of dload 1 is also for parameter access. In<br />

this case, it is primarily the result of the need to repeatedly compute the value of the

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

Saved successfully!

Ooh no, something went wrong!