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.

262<br />

The internal data structure used to store the information about each bytecode<br />

executed was a C++ STL map. The keys in the map were Instruction objects.<br />

Each value in the map was an integer which represented the count of the number<br />

of times the instruction executed. An instruction object consisted of an opcode, a<br />

vector of operands and a comment string. Each time a bytecode was executed, a new<br />

instruction object was created to represent it. If the object was not already present<br />

in the map, it was added to it with a count of one. Otherwise, the count associated<br />

with the object in the map was incremented.<br />

An exit handler was installed in order to ensure that the data collected was saved<br />

to a file when the application completed. The file format was text based, using one line<br />

to represent each unique opcode / operand pairing executed. Each line began with an<br />

integer indicating how many times the instruction executed. This was followed by an<br />

ASCII representation of the opcode name and any operands or comments recorded<br />

for that opcode.<br />

Perl scrips were developed to process the output files generated from profiling the<br />

benchmarks with this virtual machine. Those scripts generated lists of the load and<br />

store bytecodes executed by the application sorted by execution frequency. They were<br />

also used in order to evaluate the constants utilized, number of parameters to each<br />

method invoked, and the type information associated with each method parameter,<br />

field and object. Without these scripts it would have been impossible to conduct the<br />

studies presented in Chapter 5 and Chapter 6.<br />

B.2.2<br />

Multicode Block Profiling Virtual Machine<br />

The multicode block profiling virtual machine was also constructed by modifying the<br />

Kaffe virtual machine. It used an approach that was similar to the operand profiling<br />

virtual machine. Individual bytecodes were represented using integers instead of<br />

objects because it was not necessary to store information regarding their operands.<br />

A sequence of bytes representing a multicode block was expressed as a C++ STL<br />

vector of integers because this data structure was flexible and easy to use. The<br />

execution count associated with each bytecode sequence was stored in a C++ STL<br />

map.<br />

In order to identify the starting point for each multicode block, it was necessary<br />

to determine the target of each branch, the start of each exception handler and the<br />

start and end of each exception handler range. This information can be determined<br />

by examining the code attribute and the exception table. A map was used to save this

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

Saved successfully!

Ooh no, something went wrong!