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.

96<br />

The issue of underutilized specialized load and store bytecodes is further complicated<br />

by another design choice made by the designers of the Java Virtual Machine.<br />

Any time an invokevirtual, invokespecial or invokeinterface bytecode is used,<br />

the receiver object, on which the method is being invoked, is passed as the first argument<br />

to the method. It is passed just like any other method parameter. Consequently,<br />

the receiver object always resides in slot 0 in the called scope. This allows the specialized<br />

bytecode, aload 0 to be executed frequently because a reference to the receiver<br />

object is required for every same class field access and method invocation. In fact,<br />

examining Table 5.1 reveals that aload 0 is the most frequently executed specialized<br />

bytecode. However, because the receiver object always resides in local variable slot<br />

0, the bytecodes dload 0, fload 0, iload 0 and lload 0 can never execute in any<br />

instance method.<br />

Specialized store instructions are executed with even less frequency than specialized<br />

load instructions. While specialized store instructions such as istore 0,<br />

fstore 2 and dstore 3 are available for the first four local variable slots, they are<br />

rarely used. This is because the Java Virtual Machine only provides support for pass<br />

by value parameter passing semantics for its primitive numeric types and object references.<br />

Consequently, any write to a local variable that contains a parameter passed<br />

to the method will not be visible in the calling scope. While it is possible that a<br />

parameter variable may be updated during a computation, such code is rare.<br />

Writes to local variable zero are even more uncommon. In an instance method,<br />

a write to local variable slot 0 is impossible. The dstore 0, fstore 0, istore 0<br />

and lstore 0 bytecodes cannot execute in such a method because local variable<br />

slot zero is occupied by the receiver object. It is also impossible for astore 0 to<br />

execute in a virtual method because that operation represents assigning a new object<br />

reference to the receiver object – an operation that is prohibited by the Java Language<br />

Specification because the this variable is final [51].<br />

5.2.3 Category 2: Benchmarks that Show Decreased Performance<br />

as a Result of Despecialization<br />

The second category of benchmark performance covers all of those benchmarks that<br />

showed an increase in runtime (poorer performance) as the number of despecializations<br />

performed increased. This was the result that was initially anticipated to be<br />

most common. However, it was found that only 25 percent of the benchmarks tested<br />

generated results that reside in this category.

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

Saved successfully!

Ooh no, something went wrong!