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.

127<br />

6.2.5 Fields<br />

Only four bytecodes are included in the Java Virtual Machine Specification for field<br />

access. The getfield and putfield bytecodes provide the ability to read and write<br />

instance fields respectively. Similarly, the getstatic and putstatic bytecodes provide<br />

read and write access for static fields. Each of these bytecodes is able to access<br />

data of any type including array types.<br />

Figures 6.6 and 6.7 show the distribution of the types of the instance fields read<br />

and written. While the distributions are not identical, they show many similarities,<br />

with fields containing integers, object references and doubles being accessed with<br />

greatest frequency. Initially it may appear that integer writes are performed more<br />

frequently than integer reads because Figure 6.6 shows almost 32 percent of the fields<br />

accessed having integer type while Figure 6.7 shows more than 56 percent of the fields<br />

written having integer type. This is not the case. The getfield opcode accounts<br />

for more than 9.5 percent of the opcodes executed by the benchmarks considered<br />

during this study. In comparison, putfield accounts for only 1.3 percent of the<br />

bytecodes executed. Consequently, integer field reads account for about 3 percent of<br />

all bytecodes executed while integer field writes account for about 0.73 percent of all<br />

opcodes executed.<br />

Figures 6.8 and 6.9 show the distribution of the types of the static fields read<br />

and written. While the relative type distributions for getfield and putfield were<br />

similar, getstatic and putstatic show considerably different distributions. In particular,<br />

while arrays of object references and scalar object references were the static<br />

field types read with greatest frequency, the most frequently written static field types<br />

were double precision floating point numbers and integers.<br />

Static fields are accessed with much lower frequency than instance fields. Uses of<br />

getstatic account for 0.36 percent of the bytecodes executed while uses of putstatic<br />

account for less than 0.02 percent of the bytecodes executed. Based on these execution<br />

frequencies it was possible to determine how frequently each specific data type was<br />

accessed by both getstatic and putstatic. This analysis revealed that while static<br />

fields of type object reference array and object reference were read with much greater<br />

frequency than they were written, double, integer and long static fields were read and<br />

written with almost identical frequency. This pattern of behaviour is considerably<br />

different than that observed for getfield and putfield. In that case, every type was<br />

read more frequently than it was written, and in general, the reads far out numbered<br />

the writes.<br />

The utility of the information presented on fields for improving Java application

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

Saved successfully!

Ooh no, something went wrong!